Skip to content
ozanturgut edited this page Dec 10, 2012 · 2 revisions

Exported Module

module(String captureUrl [, Object options])

This function is the global Queen object (or the exported module if using CommonJS or AMD). > **Param: String _captureUrl_** The endpoint url to the Queen server to register with
**Optional Param: Object _options_** A map of optional parameters: * **_logger_ (Function)** A logging function which takes in a string as the first parameter * **_maxWorkerCount_ (Number, default=1000)** The maximum number of workers this worker provider will be able to have active simultaneously. * **_workerTimeout_ (Number, default=Infinity)** The maximum lifetime allowed for a worker in milliseconds.

Returns: WorkerProvider The worker provider instance

WorkerProvider Instance

'connect' event

> **Fires** When a connection to the Queen server is established
**Emits: undefined**

'disconnect' event

> **Fires** When a the connection to the Queen server is lost
**Emits: undefined**

'available' event

> **Fires** When the worker provider is ready to spawn additional workers.
**Emits: undefined**

'unavailable' event

> **Fires** When the worker provider is unavailable to spawn additional workers.
**Emits: undefined**

'worker' event

> **Fires** whenever a new worker is spawned.
**Emits: [Worker](#worker)** A worker instance

'workerDead' event

> **Fires** whenever a worker spawned by this worker provider is dead.
**Emits: String** The id of the dead worker instance

'dead' event

> **Fires** when this worker provider is dead.
**Emits: undefined**

workerProvider.on(String eventName, Function callback)

> **Param: String _eventName_** The event to listen to
**Param: Function _callback_** The function to execute when the event fires
**Returns: undefined**

workerProvider.removeListener(String eventName [, Function boundCallback])

If a bound callback function is not provided, all listeners will be removed for the given event. > **Param: String _eventName_** The event to stop listening to
**Optional Param: Function _boundCallback_** The bound function to remove from the listener
**Returns: undefined**

workerProvider.kill()

Kills this workerProvider and all of it's active workers. > **Returns: undefined**

workerProvider.attributes

A map of attributes for this workerProvider. > **Type: Object** * **userAgent (String)** The user agent string of the worker provider * **capabilities (Object)** An object of the browsers capabilities as determined by [Modernizr](http://modernizr.com/docs/#s2). * **applicationcache (boolean)** * **audio(Boolean)** The strings below will be empty (not supported), "maybe", or "probably". * **m4a (String)** * **mp3 (String)** * **ogg (String)** * **wav (String)** * **backgroundsize (boolean)** * **borderimage (boolean)** * **borderradius (boolean)** * **boxshadow (boolean)** * **canvas (boolean)** * **canvastext (boolean)** * **cssanimations (boolean)** * **csscolumns (boolean)** * **cssgradients (boolean)** * **cssreflections(boolean)** * **csstransforms (boolean)** * **csstransforms3d (boolean)** * **csstransitions (boolean)** * **draganddrop (boolean)** * **flexbox (boolean)** * **fontface (boolean)** * **generatedcontent (boolean)** * **geolocation (boolean)** * **hashchange (boolean)** * **history(boolean)** * **hsla (boolean)** * **indexeddb (boolean)** * **inlinesvg (boolean)** * **input (Object)** * **autocomplete (boolean)** * **autofocus(boolean)** * **list (boolean)** * **max (boolean)** * **min (boolean)** * **multiple (boolean)** * **pattern (boolean)** * **placeholder (boolean)** * **required (boolean)** * **step (boolean)** * **inputtypes (Object)** * **color (boolean)** * **date (boolean)** * **datetime (boolean)** * **datetime-local (boolean)** * **email (boolean)** * **month (boolean)** * **number (boolean)** * **range (boolean)** * **search (boolean)** * **tel (boolean)** * **time (boolean)** * **url (boolean)** * **week (boolean)** * **localstorage (boolean)** * **multiplebgs (boolean)** * **opacity (boolean)** * **postmessage (boolean)** * **rgba (boolean)** * **sessionstorage (boolean)** * **smil (boolean)** * **svg(boolean)** * **svgclippaths (boolean)** * **textshadow (boolean)** * **touch (boolean)** * **video (Boolean)** The strings below will be empty (not supported), "maybe", or "probably". * **h264 (String)** * **ogg (String)** * **webm (String)** * **webgl (boolean)** * **websockets (boolean)** * **websqldatabase (boolean)** * **webworkers (boolean)**

Worker Instance

'message' event

> **Fires** When the worker sends a message
**Emits: anything** Whatever JSON serializable data the worker is sending

'dead' event

> **Fires** When this worker is dead
**Emits: undefined**

worker.on(String eventName, Function callback)

> **Param: String _eventName_** The event to listen to
**Param: Function _callback_** The function to execute when the event fires
**Returns: undefined**

worker.removeListener(String eventName [, Function boundCallback])

If a bound callback function is not provided, all listeners will be removed for the given event. > **Param: String _eventName_** The event to stop listening to
**Optional Param: Function _boundCallback_** The bound function to remove from the listener
**Returns: undefined**

worker.kill()

Kills this worker. > **Returns: undefined**

worker.id

A universally-unique identifier for this instance > **Type: String**

Clone this wiki locally