~abreu-alexandre/unity-webapps-qml/location-specific-homepage

« back to all changes in this revision

Viewing changes to tests/unit/test_qml/tst_api_contenthub.html

Improve paramater passing to launchEmbedded UI Fixes: #1417776
Approved by: PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
 
 
3
<head>
 
4
<script>
 
5
 
 
6
var activeTransfer
 
7
 
 
8
function _shareRequested(transfer) {
 
9
    activeTransfer = transfer;
 
10
 
 
11
    var e = new CustomEvent("onsharerequest", { bubbles: true, detail: { } });
 
12
    document.documentElement.dispatchEvent(e);
 
13
 
 
14
    activeTransfer.contentType(function(type) {
 
15
        var e = new CustomEvent("received-object-value",
 
16
            { bubbles: true, detail: { value: type } });
 
17
        document.documentElement.dispatchEvent(e);
 
18
    })
 
19
}
 
20
 
 
21
function setup() {
 
22
    var api = external.getUnityObject('1.0');
 
23
    var hub = api.ContentHub;
 
24
    hub.onShareRequested(_shareRequested);
 
25
}
 
26
 
 
27
window.onload = function () {
 
28
    if (window.external && window.external.getUnityObject) {
 
29
        setup()
 
30
    } else {
 
31
        document.addEventListener('ubuntu-webapps-api-ready', function() {
 
32
            setup()
 
33
        });
 
34
    }
 
35
}
 
36
</script>
 
37
</head>
 
38
 
 
39
<body>
 
40
</body>
 
41
 
 
42
</html>