Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid deprecation warnings in Buffer with Haxe dev #116

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/js/node/buffer/Buffer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
*/
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.

It supports array access syntax to get and set the octet at index. The values refer to individual bytes,
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.
Expand Down Expand Up @@ -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<Int>):Void {})
function new(size:Int):Void;

Expand Down Expand Up @@ -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.
Expand Down