summaryrefslogtreecommitdiff
path: root/www/app/lib/bitmask.js
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2016-09-06 13:59:44 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-06 14:01:33 -0400
commitc2c603d5faee451b74bb3691e0d667325331e413 (patch)
tree48f911545e321e8f5e97c2f55f97457b47c94456 /www/app/lib/bitmask.js
parentb5e628de0c4b19be112e5c2d44991c1421d7d791 (diff)
[feature] set a default localhost:7070 if bitmask.js is loaded from file
Diffstat (limited to 'www/app/lib/bitmask.js')
-rw-r--r--www/app/lib/bitmask.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/www/app/lib/bitmask.js b/www/app/lib/bitmask.js
index 5bd684b..2cdb9fe 100644
--- a/www/app/lib/bitmask.js
+++ b/www/app/lib/bitmask.js
@@ -33,8 +33,13 @@ import "babel-polyfill";
var bitmask = function(){
var event_handlers = {};
+ var api_url = '/API/';
+ if (window.location.protocol === "file:") {
+ api_url = 'http://localhost:7070/API/';
+ }
+
function call(command) {
- var url = '/API/' + command.slice(0, 2).join('/');
+ var url = api_url + command.slice(0, 2).join('/');
var data = JSON.stringify(command.slice(2));
return new Promise(function(resolve, reject) {