forgot to add the helper functions, still doesn't work

This commit is contained in:
R. Aidan Campbell 2016-07-10 11:35:24 -04:00
parent dccff4cc92
commit 74069f3f0f

View File

@ -45,6 +45,19 @@ function NvHTTP(address, clientUid) {
_self = this;
};
function ab2str(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
function str2ab(str) {
var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
var bufView = new Uint16Array(buf);
for (var i=0, strLen=str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
NvHTTP.prototype = {
refreshServerInfo: function () {
return sendMessage('openUrl', [ _self._baseUrlHttps + '/serverinfo?' + _self._buildUidStr(), false]).then(function(ret) {