var LN = (function(){ var appInterface; var defaultOptions = { url: null, }; class LNInterface { constructor(opt){ var self = this; this.options = {} Object.assign(this.options,opt); if (this.options.url == null) this.options.url = this.constructURL(); this.rpcCallbacks = []; this.rpcNextID = 1; this.websocket = new WebSocket(this.options.url); this.websocket.onerror = function(e){ alert("WebSocket caught error: " + e.date); } this.websocket.onmessage = function(e){ try{ var j = JSON.parse(e.data); if (j.state){ updateState(j.state); } else if (j.id) { for (var n=0;n 1000000000) return ((value / 1000000000) | 0) + "G"; if (value > 1000000) return ((value / 1000000) | 0) + "M"; if (value > 1000) return ((value / 1000) | 0) + "k"; return value; } */