Browse Source

add ArrayViewBuffer fields to js.html.compat.DataView (closes #5673) (#5674)

* add ArrayViewBuffer fields to compat.DataView II

* add ArrayViewBuffer fields to compat.DataView
ousado 9 years ago
parent
commit
6be532249c
1 changed files with 7 additions and 0 deletions
  1. 7 0
      std/js/html/compat/DataView.hx

+ 7 - 0
std/js/html/compat/DataView.hx

@@ -32,12 +32,19 @@ class DataView {
 	var offset : Int;
 	var offset : Int;
 	var length : Int;
 	var length : Int;
 
 
+	public var byteLength(default,null):Int;
+	public var byteOffset(default,null):Int;
+	public var buffer(default,null):ArrayBuffer;
+
 	public function new( buffer : ArrayBuffer, ?byteOffset : Int, ?byteLength : Int ) : Void {
 	public function new( buffer : ArrayBuffer, ?byteOffset : Int, ?byteLength : Int ) : Void {
 		this.buf = buffer;
 		this.buf = buffer;
 		this.offset = byteOffset == null ? 0 : byteOffset;
 		this.offset = byteOffset == null ? 0 : byteOffset;
 		this.length = byteLength == null ? buffer.byteLength - this.offset : byteLength;
 		this.length = byteLength == null ? buffer.byteLength - this.offset : byteLength;
 		if( offset < 0 || length < 0 || offset+length > buffer.byteLength )
 		if( offset < 0 || length < 0 || offset+length > buffer.byteLength )
 			throw OutsideBounds;
 			throw OutsideBounds;
+		this.byteLength = length;
+		this.byteOffset = offset;
+		this.buffer = buf;
 	}
 	}
 
 
 	public function getInt8( byteOffset : Int ) : Int {
 	public function getInt8( byteOffset : Int ) : Int {