~abreu-alexandre/unity-webapps-qml/enhance-launch-embedded-ui

« back to all changes in this revision

Viewing changes to src/Ubuntu/UnityWebApps/UnityWebApps.js

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:
33
33
    /**
34
34
     * \param parentItem
35
35
     * \param bindeeProxies
36
 
     * \param backends
37
 
     * \param userscriptContent
 
36
     * \param accessPolicy
 
37
     * \param injected_api_path
 
38
     * \param dispatched_callback
38
39
     */
39
 
    function _UnityWebApps(parentItem, bindeeProxies, accessPolicy, injected_api_path) {
 
40
    function _UnityWebApps(
 
41
            parentItem,
 
42
            bindeeProxies,
 
43
            accessPolicy,
 
44
            injected_api_path,
 
45
            dispatched_callback) {
40
46
        this._injected_unity_api_path = injected_api_path;
41
47
        this._bindeeProxies = bindeeProxies;
42
48
        this._backends = null;
43
49
        this._accessPolicy = accessPolicy;
44
50
        this._callbackManager = UnityWebAppsUtils.makeCallbackManager();
 
51
        this._dispatchedCallback = dispatched_callback
45
52
 
46
53
        this._bind();
47
54
    };
152
159
                    return;
153
160
                }
154
161
 
 
162
 
155
163
                this._log ('WebApps API message being dispatch: ' + apiCallName);
156
164
 
 
165
                if (this._dispatchedCallback &&
 
166
                        typeof(this._dispatchedCallback) === 'function') {
 
167
                    this._dispatchedCallback({type: "dispatching", name: apiCallName})
 
168
                }
 
169
 
157
170
                this._dispatchApiCall (message.name, params);
158
171
 
159
172
            } else if (target === UnityWebAppsUtils.UBUNTU_WEBAPPS_BINDING_OBJECT_METHOD_CALL_MESSAGE) {
215
228
                }, reducetarget);
216
229
                t.apply (null, args);
217
230
 
 
231
                if (this._dispatchedCallback &&
 
232
                        typeof(this._dispatchedCallback) === 'function') {
 
233
                    this._dispatchedCallback({type: "called", name: name})
 
234
                }
 
235
 
218
236
            } catch (err) {
219
237
              this._log('Error while dispatching call to ' + names.join('.') + ': ' + err);
220
238
            }