aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/chromereload.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2015-08-01 09:38:02 +0800
committerkumavis <aaron@kumavis.me>2015-08-01 09:38:02 +0800
commit500a95a70492fc319ad1984da36773952a2086e6 (patch)
treef9e5f3752414c5f414379fe579d6714a48cdad1c /app/scripts/chromereload.js
downloadtangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar.gz
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar.bz2
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar.lz
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar.xz
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.tar.zst
tangerine-wallet-browser-500a95a70492fc319ad1984da36773952a2086e6.zip
init commit
Diffstat (limited to 'app/scripts/chromereload.js')
-rw-r--r--app/scripts/chromereload.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/scripts/chromereload.js b/app/scripts/chromereload.js
new file mode 100644
index 000000000..a01466484
--- /dev/null
+++ b/app/scripts/chromereload.js
@@ -0,0 +1,22 @@
+'use strict';
+
+// Reload client for Chrome Apps & Extensions.
+// The reload client has a compatibility with livereload.
+// WARNING: only supports reload command.
+
+var LIVERELOAD_HOST = 'localhost:';
+var LIVERELOAD_PORT = 35729;
+var connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload');
+
+connection.onerror = function (error) {
+ console.log('reload connection got error:', error);
+};
+
+connection.onmessage = function (e) {
+ if (e.data) {
+ var data = JSON.parse(e.data);
+ if (data && data.command === 'reload') {
+ chrome.runtime.reload();
+ }
+ }
+};