Просмотр исходного кода

[js] use Uint8Array view of haxe.io.Bytes instead of ArrayBuffer, since the latter doesn't allow any interaction (see #5086)

Dan Korostelev 9 лет назад
Родитель
Сommit
123224deb9
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      std/haxe/io/Output.hx

+ 3 - 3
std/haxe/io/Output.hx

@@ -55,12 +55,12 @@ class Output {
 		See `writeFullBytes` that tries to write the exact amount of specified bytes.
 	**/
 	public function writeBytes( s : Bytes, pos : Int, len : Int ) : Int {
-		var k = len;
-		var b = s.getData();
 		#if !neko
 		if( pos < 0 || len < 0 || pos + len > s.length )
 			throw Error.OutsideBounds;
 		#end
+		var b = #if js @:privateAccess s.b #else s.getData() #end;
+		var k = len;
 		while( k > 0 ) {
 			#if neko
 				writeByte(untyped __dollar__sget(b,pos));
@@ -69,7 +69,7 @@ class Output {
 			#elseif cpp
 				writeByte(untyped b[pos]);
 			#elseif hl
-				writeByte(@:privateAccess b.b[pos]);
+				writeByte(@:privateAccess b[pos]);
 			#else
 				writeByte(untyped b[pos]);
 			#end