webworkers.d.ts 936 B

1234567891011121314151617181920212223242526272829
  1. // Type definitions for SharedWorker
  2. // Project: http://www.w3.org/TR/workers/
  3. // Definitions by: Toshiya Nakakura <https://github.com/nakakura>
  4. // Definitions: https://github.com/borisyankov/DefinitelyTyped
  5. declare module SharedWorker {
  6. interface AbstractWorker extends EventTarget {
  7. onerror: (ev: ErrorEvent) => any;
  8. }
  9. export interface SharedWorker extends AbstractWorker {
  10. /**
  11. * the value it was assigned by the object's constructor.
  12. * It represents the MessagePort for communicating with the shared worker.
  13. * @type {MessagePort}
  14. */
  15. port: MessagePort;
  16. }
  17. }
  18. declare var SharedWorker: {
  19. prototype: SharedWorker.SharedWorker;
  20. /***
  21. *
  22. * @param {string} stringUrl Pathname to JavaScript file
  23. * @param {string} name Name of the worker to execute
  24. */
  25. new (stringUrl: string, name?: string): SharedWorker.SharedWorker;
  26. };