Kaynağa Gözat

[js] Add extern for the `structuredClone()` function (#10607)

* [js] Add extern for the `structuredClone()` function

* [js] Improve the extern of the `structuredClone()` function

* [js] Move the `structuredClone` function to the `js.html` package
Cédric Belin 3 yıl önce
ebeveyn
işleme
4c81642abd
2 değiştirilmiş dosya ile 11 ekleme ve 4 silme
  1. 5 2
      std/js/html/Window.hx
  2. 6 2
      std/js/html/WorkerGlobalScope.hx

+ 5 - 2
std/js/html/Window.hx

@@ -20,8 +20,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-// This file is generated from mozilla\Window.webidl. Do not edit!
-
 package js.html;
 
 import js.lib.Promise;
@@ -559,6 +557,11 @@ extern class Window extends EventTarget {
 	**/
 	function dump( str : String ) : Void;
 
+	/**
+		Creates a deep clone of a given value using the structured clone algorithm.
+	**/
+	function structuredClone<T>(value: T, ?options: {transfer: Array<Any>}): T;
+
 	/**
 		Toggles a user's ability to resize a window.
 	**/

+ 6 - 2
std/js/html/WorkerGlobalScope.hx

@@ -20,8 +20,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-// This file is generated from mozilla\WorkerGlobalScope.webidl. Do not edit!
-
 package js.html;
 
 import js.lib.Promise;
@@ -83,6 +81,12 @@ extern class WorkerGlobalScope extends EventTarget {
 		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.
 	**/
 	function dump( ?str : String ) : Void;
+
+	/**
+		Creates a deep clone of a given value using the structured clone algorithm.
+	**/
+	function structuredClone<T>(value: T, ?options: {transfer: Array<Any>}): T;
+
 	/** @throws DOMError */
 	function btoa( btoa : String ) : String;
 	/** @throws DOMError */