[JavaScript] 纯文本查看 复制代码 var url = Laya.ResourceVersion.addVersionPrefix("libs/min/aesresc");
var ver = Laya.Browser.window.rescVersion ? Laya.Browser.window.rescVersion : '1.0';
Laya.Browser.window.JSZipUtils.getBinaryContent(url + '?v=' + ver, function(err, data) {
if (err) {
alert("zip下载失败");
} else {
var key_1 = [0];
var iv_1 = [0];
var STACKTOP = 0;
var env_1 = {
memory: new Laya.Browser.window.WebAssembly.Memory({
initial: 256,
maximum: 256
}),
STACKTOP: STACKTOP,
abort: function abort() {},
seed: Date.now
};
Laya.Browser.window.WebAssembly.instantiate(data, {
env: env_1
}).then(function(result) {
var encryUtil = new CtrUtil();
CtrUtil.Ctr = encryUtil;
encryUtil.blockPointer = encryUtil.staticMalloc(0);
encryUtil.byteView = new Uint8Array(env_1.memory.buffer);
encryUtil.buffer = env_1.memory.buffer;
encryUtil.meBuffer = new Uint32Array(result.instance.exports.memory.buffer);
encryUtil.Init(key_1, iv_1, result.instance);
if (callback)
callback();
}).catch(function(e) {
alert("zip解析失败:" + e);
});
}
});
这就是一个 WebAssembly
|