summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index 89b90978..0cae6566 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -25,6 +25,12 @@ var tools = new function() {
this.forEach = (...args) => Array.prototype.forEach.call(...args);
+ this.setDefault = function(dict, key, value) {
+ if (!(key in dict)) {
+ dict[key] = value;
+ }
+ };
+
this.makeRequest = function(method, url, callback, body=null, content_type=null) {
var http = new XMLHttpRequest();
http.open(method, url, true);