Allow overriding bytes.length on CommonJS

This commit is contained in:
Joshua Granick
2018-02-06 14:25:26 -08:00
parent 5ad0fded29
commit 57a185bbfe

View File

@@ -608,7 +608,12 @@ import js.html.compat.DataView;
class Bytes {
#if commonjs
public var length(get,set) : Int;
var l : Int;
#else
public var length(default,null) : Int;
#end
var b : js.html.Uint8Array;
var data : js.html.DataView;
@@ -812,6 +817,16 @@ class Bytes {
return untyped b.bytes[pos];
}
#if commonjs
private function get_length() : Int {
return l;
}
private function set_length( v : Int ) : Int {
return l = v;
}
#end
}