build: update gulp-haxetool version

This commit is contained in:
2021-05-28 20:52:13 +03:00
parent e6a11efe64
commit bba9e69fb4
4 changed files with 7793 additions and 328 deletions

View File

@@ -1,17 +1,24 @@
package ru.m;
import flash.net.FileFilter;
import flash.net.FileReference;
import openfl.net.FileFilter;
import openfl.net.FileReference;
import openfl.utils.ByteArray;
class Callback<T> {
private var callback:T -> Void;
private var success:T -> Void;
private var fail:Dynamic -> Void;
public function new(callback: T -> Void) {
this.callback = callback;
public function new(success: T -> Void, fail: Dynamic -> Void) {
this.success = success;
this.fail = fail;
}
public function execute(result:T):Void {
this.callback(result);
public function onSuccess(result:T):Void {
this.success(result);
}
public function onFail(error:Dynamic):Void {
this.fail(error);
}
}
@@ -24,12 +31,19 @@ class ModernFileReference extends FileReference {
);
#end
override function browse(?typeFilter:Array<FileFilter>):Bool {
override public function browse(?typeFilter:Array<FileFilter>):Bool {
#if android
fileUtilBrowse(new Callback<haxe.io.BytesData>(function(result:haxe.io.BytesData):Void {
data = result;
fileUtilBrowse(new Callback<haxe.io.BytesData>(
function(result:haxe.io.BytesData):Void {
data = ByteArray.fromBytesData(result);
dispatchEvent(new flash.events.Event(flash.events.Event.COMPLETE));
}));
},
function(error:Dynamic):Void {
dispatchEvent(new flash.events.IOErrorEvent(
flash.events.IOErrorEvent.IO_ERROR, false, false, Std.string(error)
));
}
));
return true;
#else
return super.browse(typeFilter);