Class: Messenger

WinJSContrib. Messenger

Wrapper for messaging between main code and iframe or web worker. All returns are wrapped as WinJS.Promise to enable asynchronous scenarios

new Messenger(receiver, sender)

Parameters:
Name Type Description
receiver DOMElement

element that will receive messages

sender DOMElement

element that will send messages

Source:

Classes

SmartWorker

Members

<static> SmartWorkerPath

default path for smart worker js file

Source:

Methods

dispose()

release messenger and associated resources (if using webworker, worker is terminated

Source:

execute(func, args) → {WinJS.Promise}

run the callback in the web worker. The callback is serialized to string so you must pass all variable used inside the function as arguments

Parameters:
Name Type Argument Description
func function

function callback

args Object <repeatable>
Source:
Returns:
Type
WinJS.Promise

importScripts(scriptPaths)

import script files

Parameters:
Name Type Description
scriptPaths Array

an array of string paths to js files

Source:

start(eventName, data) → {WinJS.Promise}

start an operation within iframe or worker and get a promise for completion

Parameters:
Name Type Description
eventName string

name of the event/function to call

data Object

event/function passed as argument

Source:
Returns:
Type
WinJS.Promise