2
0

WorkerGlobalScope.hx 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (C)2005-2017 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\WorkerGlobalScope.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `WorkerGlobalScope` interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by `Window` objects — in this case event handlers, the console or the associated `WorkerNavigator` object. Each `WorkerGlobalScope` has its own event loop.
  26. Documentation [WorkerGlobalScope](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope>
  28. **/
  29. @:native("WorkerGlobalScope")
  30. extern class WorkerGlobalScope extends EventTarget
  31. {
  32. /**
  33. Returns a reference to the `WorkerGlobalScope` itself. Most of the time it is a specific scope like `DedicatedWorkerGlobalScope`,  `SharedWorkerGlobalScope` or `ServiceWorkerGlobalScope`.
  34. **/
  35. var self(default,null) : WorkerGlobalScope;
  36. /**
  37. Returns the `Console` associated with the worker.
  38. **/
  39. var console(default,null) : Console;
  40. /**
  41. 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.
  42. **/
  43. var location(default,null) : WorkerLocation;
  44. /**
  45. Is an `EventHandler` representing the code to be called when the `error` event is raised.
  46. **/
  47. var onerror : haxe.extern.EitherType<Event,String> -> String -> Int -> Int -> Dynamic -> Bool;
  48. /**
  49. Is an `EventHandler` representing the code to be called when the `offline` event is raised.
  50. **/
  51. var onoffline : haxe.Constraints.Function;
  52. /**
  53. Is an `EventHandler` representing the code to be called when the `online` event is raised.
  54. **/
  55. var ononline : haxe.Constraints.Function;
  56. /**
  57. 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.
  58. **/
  59. var navigator(default,null) : WorkerNavigator;
  60. /**
  61. Is an `EventHandler` representing the code to be called when the `close` event is raised.
  62. **/
  63. var onclose : haxe.Constraints.Function;
  64. /**
  65. Returns the `Performance` associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers.
  66. **/
  67. var performance(default,null) : Performance;
  68. var indexedDB(default,null) : js.html.idb.Factory;
  69. /** @throws DOMError */
  70. /**
  71. Discards any tasks queued in the `WorkerGlobalScope`'s event loop, effectively closing this particular scope.
  72. **/
  73. function close() : Void;
  74. /** @throws DOMError */
  75. /**
  76. 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');`
  77. **/
  78. function importScripts( urls : haxe.extern.Rest<String> ) : Void;
  79. /**
  80. Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's `window.dump`, but for workers.
  81. **/
  82. function dump( ?str : String ) : Void;
  83. /** @throws DOMError */
  84. function fetch( input : haxe.extern.EitherType<Request,String>, ?init : RequestInit ) : Promise<Response>;
  85. /** @throws DOMError */
  86. @:overload( function( aImage : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<VideoElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<Blob,haxe.extern.EitherType<ImageData,haxe.extern.EitherType<CanvasRenderingContext2D,ImageBitmap>>>>>> ) : Promise<ImageBitmap> {} )
  87. function createImageBitmap( aImage : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<VideoElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<Blob,haxe.extern.EitherType<ImageData,haxe.extern.EitherType<CanvasRenderingContext2D,ImageBitmap>>>>>>, aSx : Int, aSy : Int, aSw : Int, aSh : Int ) : Promise<ImageBitmap>;
  88. /** @throws DOMError */
  89. function btoa( btoa : String ) : String;
  90. /** @throws DOMError */
  91. function atob( atob : String ) : String;
  92. /** @throws DOMError */
  93. @:overload( function( handler : haxe.Constraints.Function, ?timeout : Int = 0, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  94. function setTimeout( handler : String, ?timeout : Int = 0, unused : haxe.extern.Rest<Dynamic> ) : Int;
  95. function clearTimeout( ?handle : Int = 0 ) : Void;
  96. /** @throws DOMError */
  97. @:overload( function( handler : haxe.Constraints.Function, ?timeout : Int, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  98. function setInterval( handler : String, ?timeout : Int, unused : haxe.extern.Rest<Dynamic> ) : Int;
  99. function clearInterval( ?handle : Int = 0 ) : Void;
  100. }