UNPKG

declarations

Version:

[![npm version](https://badge.fury.io/js/declarations.svg)](https://www.npmjs.com/package/declarations)

30 lines (26 loc) 943 B
// Type definitions for SharedWorker // Project: http://www.w3.org/TR/workers/ // Definitions by: Toshiya Nakakura <https://github.com/nakakura> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace SharedWorker { interface AbstractWorker extends EventTarget { onerror: (ev: ErrorEvent) => any; } export interface SharedWorker extends AbstractWorker { /** * the value it was assigned by the object's constructor. * It represents the MessagePort for communicating with the shared worker. * @type {MessagePort} */ port: MessagePort; } } declare var SharedWorker: { prototype: SharedWorker.SharedWorker; /*** * * @param {string} stringUrl Pathname to JavaScript file * @param {string} name Name of the worker to execute */ new (stringUrl: string, name?: string): SharedWorker.SharedWorker; };