mozilla
Your Search Results

    WorkerGlobalScope

    « WorkerGlobalScope

    The WorkerGlobalScope is an interface representing the scope of any worker. Workers having no browsing context, this scope contains the information usually conveyed by the Window objects, like event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop.

    This interface is usually specialized by each worker type: DedicatedWorkerGlobalScope for dedicated workers, SharedWorkerGlobalScope for shared workers, and ServiceWorkerGlobalScope. The self property returns the specialized scope for each context.

    Properties

    This interface inherits properties from the EventTarget interface and implements properties from WindowTimers, WindowBase64, and WindowEventHandlers.

    WorkerGlobalScope.self Read only
    Returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScopeSharedWorkerGlobalScope or ServiceWorkerGlobalScope.
    WorkerGlobalScope.console Read only
    Returns the Console associated with the worker.
    WorkerGlobalScope.location Read only
    Returns the WorkerLocation associated with the worker. It is a specific location object, mostly a subset of the Location for browsing scopes, but adapted to workers.
    WorkerGlobalScope.navigator Read only
    Returns the WorkerNavigator associated with the worker. It is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers.
    WorkerGlobalScope.performance Read only
    Returns the Performance associated with the worker. Also it is the regular performance object, only a subset of its property and methods are available to workers.

    Methods

    This interface inherits methods from the EventTarget interface and implements methods from WindowTimers, WindowBase64, and WindowEventHandlers.

    WindowBase64.atob()
    Decodes a string of data which has been encoded using base-64 encoding.
    WindowBase64.btoa()
    Creates a base-64 encoded ASCII string from a string of binary data.
    WindowTimers.clearInterval()
    Cancels the repeated execution set using WindowTimers.setInterval().
    WindowTimers.clearTimeout()
    Cancels the repeated execution set using WindowTimers.setTimeout().
    WindowTimers.setInterval()
    Schedules the execution of a function each X milliseconds.
    WindowTimers.setTimeout()
    Sets a delay for executing a function.
    WorkerGlobalScope.close()
     
    WorkerGlobalScope.dump()
    Writes a message to the console.
    WorkerGlobalScope.importScripts()

    Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example: importScripts('foo.js', 'bar.js');

    Event Handlers

    This interface inherits event handlers from the EventTarget interface and implements event handlers from WindowTimers, and WindowBase64.

    WorkerGlobalScope.onerror
    Is an EventHandler representing the code to be called when the error event is raised.
    WorkerGlobalScope.onoffline
    Is an EventHandler representing the code to be called when the offline event is raised.
    WorkerGlobalScope.ononline
    Is an EventHandler representing the code to be called when the online event is raised.
    WorkerGlobalScope.onclose
    Is an EventHandler representing the code to be called when the close event is raised.

    Specifications

    Specification Status Comment
    Web Workers
    The definition of 'WorkerNavigator' in that specification.
    Candidate Recommendation Initial definition

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support ? 3.5 (1.9.1) ? ? ?
    ononline, onoffline ? 29 (29) ? ? ?
    console ? 29 (29) as  WorkerConsole
    30 (30) as the regular Console
    ? ? ?
    performance ? 34 (34) ? ? ?
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support ? ? 1.0 (1.9.1) ? ? ?
    ononline, onoffline ? ? 29.0 (29) as a specific WorkerConsole
    30.0 (30) as the regular Console
    ? ? ?
    console ? ? 29.0 (29) ? ? ?
    performance ? ? 34.0 (34) ? ? ?

    See also

     
     

    Document Tags and Contributors

    Contributors to this page: teoli
    Last updated by: teoli,