Skip to content

Instantly share code, notes, and snippets.

@Nyrox
Created October 8, 2018 09:34
Show Gist options
  • Save Nyrox/0f19feb73d1893e3803bf4f82ad40e16 to your computer and use it in GitHub Desktop.
Save Nyrox/0f19feb73d1893e3803bf4f82ad40e16 to your computer and use it in GitHub Desktop.
/* tslint:disable */
var wasm;
const TextDecoder = require('util').TextDecoder;
let cachedDecoder = new TextDecoder('utf-8');
let cachegetUint8Memory = null;
function getUint8Memory() {
if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) {
cachegetUint8Memory = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory;
}
function getStringFromWasm(ptr, len) {
return cachedDecoder.decode(getUint8Memory().subarray(ptr, ptr + len));
}
/**
* @returns {void}
*/
module.exports.greet = function() {
return wasm.greet();
};
module.exports.__wbg_alert_3810d3a67bf4ff6a = function(arg0, arg1) {
let varg0 = getStringFromWasm(arg0, arg1);
alert(varg0);
};
function M(wasm) {
this.greet = () => wasm.greet();
}
module.exports = new Promise(function(resolve, reject) {
let w = require("./editor_frontend_bg");
w.then(function(result) {
console.log(result);
wasm = result.instance.exports;
resolve(new M(wasm));
}, function(err) {
reject(err);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment