Skip to content

Commit bfc9243

Browse files
committed
Added getKeys to networktables.js
Added getKeys which gets all the keys in the NetworkTables.
1 parent 819c64d commit bfc9243

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pynetworktables2js/js/networktables.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ var NetworkTables = new function () {
3737
return this._[d3_map_escape(key)];
3838
};
3939

40+
this.getKeys = function() {
41+
var keys = [];
42+
for(var key in this._) keys.push(d3_map_unescape(key));
43+
return keys;
44+
};
45+
4046
this.has = function(key) {
4147
return d3_map_escape(key) in this._;
4248
};
@@ -181,6 +187,11 @@ var NetworkTables = new function () {
181187
return ntCache.has(key);
182188
};
183189

190+
// Returns all the keys in the NetworkTables
191+
this.getKeys = function() {
192+
return ntCache.getKeys();
193+
};
194+
184195
/**
185196
Returns the value that the key maps to. If the websocket is not
186197
open, this will always return the default value specified.

0 commit comments

Comments
 (0)