From 4d306e08c0b4e55c786a905ae98b523c588153d5 Mon Sep 17 00:00:00 2001 From: Jens Fischer Date: Tue, 12 Mar 2019 15:12:30 +0100 Subject: [PATCH] Avoid deprecation warnings in Buffer with Haxe dev see HaxeFoundation/haxe#7894 --- src/js/node/buffer/Buffer.hx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/js/node/buffer/Buffer.hx b/src/js/node/buffer/Buffer.hx index 2f165173..b11d0cfe 100644 --- a/src/js/node/buffer/Buffer.hx +++ b/src/js/node/buffer/Buffer.hx @@ -21,6 +21,14 @@ */ package js.node.buffer; +#if haxe4 +import js.lib.ArrayBuffer; +import js.lib.Uint8Array; +#else +import js.html.ArrayBuffer; +import js.html.Uint8Array; +#end + /** The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. @@ -28,7 +36,7 @@ package js.node.buffer; so the legal range is between 0x00 and 0xFF hex or 0 and 255. **/ @:jsRequire("buffer", "Buffer") -extern class Buffer extends js.html.Uint8Array { +extern class Buffer extends Uint8Array { /** How many bytes will be returned when `buffer.inspect()` is called. @@ -107,7 +115,7 @@ extern class Buffer extends js.html.Uint8Array { **/ @:overload(function(string:String, ?encoding:String):Void {}) @:overload(function(buffer:Buffer):Void {}) - @:overload(function(arrayBuffer:js.html.ArrayBuffer, ?byteOffset:Int, ?length:Int):Void {}) + @:overload(function(arrayBuffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void {}) @:overload(function(array:Array):Void {}) function new(size:Int):Void; @@ -142,7 +150,7 @@ extern class Buffer extends js.html.Uint8Array { @:overload(function(buffer:Buffer):Buffer {}) @:overload(function(str:String, ?encoding:String):Buffer {}) - static function from(arrayBuffer:js.html.ArrayBuffer, ?byteOffset:Int, ?length:Int):Buffer; + static function from(arrayBuffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Buffer; /** Returns a JSON-representation of the `Buffer` instance.