diff options
author | Kristian Lyngstol <kly@kly@.no> | 2016-03-22 19:54:00 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly@.no> | 2016-03-22 19:54:00 +0100 |
commit | 8e2fb5f3c7fbfbb13224f0cb8a610837bfef364a (patch) | |
tree | e4a2d43eb86e912f44b8d397e8f86450a1d0469a /web/nms-public.gathering.org/js/nms-data.js | |
parent | 05fedaa7461c6fd67c402671f0e129b3d1772fbf (diff) |
Update nms-public code
Diffstat (limited to 'web/nms-public.gathering.org/js/nms-data.js')
-rw-r--r-- | web/nms-public.gathering.org/js/nms-data.js | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/web/nms-public.gathering.org/js/nms-data.js b/web/nms-public.gathering.org/js/nms-data.js index 6432a8d..14e5fed 100644 --- a/web/nms-public.gathering.org/js/nms-data.js +++ b/web/nms-public.gathering.org/js/nms-data.js @@ -82,7 +82,7 @@ var nmsData = nmsData || { nmsData._dropData = function (name) { delete this[name]; delete this.old[name]; -} +}; nmsData.removeSource = function (name) { if (this._sources[name] == undefined) { @@ -94,7 +94,7 @@ nmsData.removeSource = function (name) { clearInterval(this._sources[name]['handle']); } delete this._sources[name]; -} +}; /* * Register a source. @@ -121,7 +121,7 @@ nmsData.registerSource = function(name, target) { } this.stats.pollSets++; -} +}; /* * Add a handler (callback) for a source, using an id. @@ -130,7 +130,6 @@ nmsData.registerSource = function(name, target) { * old id, not add a copy. */ nmsData.addHandler = function(name, id, cb, cbdata) { - try { var cbob = { id: id, name: name, @@ -143,9 +142,7 @@ nmsData.addHandler = function(name, id, cb, cbdata) { } this._sources[name].cbs[id] = cbob; this.updateSource(name); - } catch (e) { - } -} +}; /* * Unregister all handlers with the "id" for all sources. @@ -157,11 +154,11 @@ nmsData.unregisterHandlerWildcard = function(id) { for (var v in nmsData._sources) { this.unregisterHandler(v, id); } -} +}; nmsData.unregisterHandler = function(name, id) { delete this._sources[name].cbs[id]; -} +}; /* * Updates a source. @@ -184,11 +181,11 @@ nmsData.updateSource = function(name) { return; } this._genericUpdater(name, true); -} +}; nmsData.invalidate = function(name) { this._genericUpdater(name, false); -} +}; /* * Reset a source, deleting all data, including old. * @@ -198,7 +195,7 @@ nmsData.resetSource = function(name) { this[name] = {}; this.old[name] = {}; this.updateSource(name); -} +}; /* * Updates nmsData[name] and nmsData.old[name], issuing any callbacks where @@ -239,16 +236,16 @@ nmsData._genericUpdater = function(name, cacheok) { nmsData[name] = data; nmsMap.drawNow(); for (var i in nmsData._sources[name].cbs) { - var tmp = nmsData._sources[name].cbs[i]; - if (tmp.cb != undefined) { - tmp.cb(tmp.cbdata); + var tmp2 = nmsData._sources[name].cbs[i]; + if (tmp2.cb != undefined) { + tmp2.cb(tmp2.cbdata); } } } else { - for (var i in nmsData._sources[name].cbs) { - var tmp = nmsData._sources[name].cbs[i]; + for (var j in nmsData._sources[name].cbs) { + var tmp = nmsData._sources[name].cbs[j]; if (tmp.cb != undefined && tmp.fresh) { - nmsData._sources[name].cbs[i].fresh = false; + nmsData._sources[name].cbs[j].fresh = false; tmp.cb(tmp.cbdata); } } |