mergeInto(LibraryManager.library, { Hello: function () { window.alert("Hello, world!"); }, HelloString: function (str) { // window.alert(Pointer_stringify(str)); window.alert(UTF8ToString(str)); }, PrintFloatArray: function (array, size) { for(var i = 0; i < size; i++) console.log(HEAPF32[(array >> 2) + i]); }, AddNumbers: function (x, y) { return x + y; }, StringReturnValueFunction: function () { var returnStr = "bla"; var bufferSize = lengthBytesUTF8(returnStr) + 1; var buffer = _malloc(bufferSize); stringToUTF8(returnStr, buffer, bufferSize); return buffer; }, BindWebGLTexture: function (texture) { GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[texture]); }, Connect: function (host, port, clientId, username, password, destination) { mqttConnect(UTF8ToString(host), UTF8ToString(port), UTF8ToString(clientId), UTF8ToString(username), UTF8ToString(password), UTF8ToString(destination)); }, Subscribe: function (topic) { mqttSubscribe(UTF8ToString(topic)) }, Send: function (topic, payload) { mqttSend(UTF8ToString(topic), UTF8ToString(payload)) }, Unsubscribe: function(topic) { mqttUnsubscribe(UTF8ToString(topic)); }, Disconnect: function() { mqttDisconnect(); } });