Browse code

Merge branch 'retry_at_js_level' of ssh://jonget.fr:5522/volume1/web/gitlist.1.0.2/repos/synocam_home_switch/ into retry_at_js_level

louis.jonget authored on24/01/2023 10:19:56
Showing3 changed files
... ...
@@ -1,8 +1,8 @@
1 1
 argv = ['/home/louis/.pebble-sdk/SDKs/current/sdk-core/pebble/waf', 'configure']
2
-environ = {'LC_NUMERIC': 'fr_FR.UTF-8', 'QT4_IM_MODULE': 'xim', 'GJS_DEBUG_OUTPUT': 'stderr', 'PEBBLE_TOOLCHAIN_PATH': '/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/arm-cs-tools/bin', 'XDG_CURRENT_DESKTOP': 'ubuntu:GNOME', 'QT_IM_MODULE': 'xim', 'LOGNAME': 'louis', 'USER': 'louis', 'PATH': '/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/arm-cs-tools/bin:/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/bin:/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin', 'LC_PAPER': 'fr_FR.UTF-8', 'HOME': '/home/louis', 'XRDP_SESSION': '1', 'DISPLAY': ':10.0', 'SSH_AGENT_PID': '2174', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'UID': '1000', 'SESSION_MANAGER': 'local/ubuntu-IDS:@/tmp/.ICE-unix/2087,unix/ubuntu-IDS:/tmp/.ICE-unix/2087', 'LC_MEASUREMENT': 'fr_FR.UTF-8', 'QT_ACCESSIBILITY': '1', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'CLUTTER_IM_MODULE': 'xim', 'TEXTDOMAIN': 'im-config', 'XMODIFIERS': '@im=ibus', 'GPG_AGENT_INFO': '/run/user/1000/gnupg/S.gpg-agent:0:1', 'NOCLIMB': '1', 'SHLVL': '2', 'XRDP_SOCKET_PATH': '/var/run/xrdp/sockdir', 'XDG_RUNTIME_DIR': '/run/user/1000', 'GTK_IM_MODULE': 'ibus', 'LC_ADDRESS': 'fr_FR.UTF-8', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'VTE_VERSION': '5202', 'IM_CONFIG_PHASE': '2', 'TEXTDOMAINDIR': '/usr/share/locale/', 'GNOME_SHELL_SESSION_MODE': 'ubuntu', 'NO_GCE_CHECK': 'False', 'PULSE_SCRIPT': '/etc/xrdp/pulse/default.pa', 'LESSOPEN': '| /bin/lesspipe %s', 'XDG_SESSION_ID': 'c3', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', '_': '/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/.env/bin/python', 'GNOME_TERMINAL_SERVICE': ':1.70', 'LC_IDENTIFICATION': 'fr_FR.UTF-8', 'LESSCLOSE': '/bin/lesspipe %s %s', 'GTK_MODULES': 'gail:atk-bridge', 'OLDPWD': '/home/louis/pebble-dev/repo_remote/synocam_home_switch/build', 'PYTHONHOME': '/home/louis/.pebble-sdk/SDKs/current/sdk-core/../.env', 'LC_TELEPHONE': 'fr_FR.UTF-8', 'NODE_PATH': '/home/louis/.pebble-sdk/SDKs/current/sdk-core/../node_modules', 'LC_MONETARY': 'fr_FR.UTF-8', 'XDG_DATA_DIRS': '/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop', 'PWD': '/home/louis/pebble-dev/repo_remote/synocam_home_switch', 'COLORTERM': 'truecolor', 'LC_NAME': 'fr_FR.UTF-8', 'XDG_MENU_PREFIX': 'gnome-', 'LC_TIME': 'fr_FR.UTF-8', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'PHONESIM_PATH': '/home/louis/pebble-dev/pebble-sdk-4.6-rc2-linux64/.env//bin/pypkjs', 'GJS_DEBUG_TOPICS': 'JS ERROR;JS LOG', 'GNOME_TERMINAL_SCREEN': '/org/gnome/Terminal/screen/e2f7f31b_8f0d_4168_972d_1f5ac7d37cd2'}
3
-files = ['/home/louis/pebble-dev/repo_remote/synocam_home_switch/wscript']
4
-hash = -2431564940392307765
5
-options = {'files': '', 'jobs': 2, 'verbose': 0, 'nocache': False, 'progress_bar': 0, 'no_groups': False, 'distcheck_args': None, 'top': '', 'sandbox': False, 'destdir': '', 'keep': 0, 'zones': '', 'debug': False, 'prefix': '/usr/local/', 'timestamp': None, 'download': False, 'force': False, 'targets': '', 'out': ''}
6
-out_dir = '/home/louis/pebble-dev/repo_remote/synocam_home_switch/build'
7
-run_dir = '/home/louis/pebble-dev/repo_remote/synocam_home_switch'
8
-top_dir = '/home/louis/pebble-dev/repo_remote/synocam_home_switch'
2
+environ = {'WSL_INTEROP': '/run/WSL/10_interop', 'PEBBLE_TOOLCHAIN_PATH': '/home/louis/pebble-dev/pebble-sdk-4.5-linux64/arm-cs-tools/bin', 'WSL_DISTRO_NAME': 'Ubuntu-18.04', 'HOSTTYPE': 'x86_64', 'LESSOPEN': '| /usr/bin/lesspipe %s', 'LOGNAME': 'louis', 'USER': 'louis', 'NO_GCE_CHECK': 'False', 'PATH': '/home/louis/pebble-dev/pebble-sdk-4.5-linux64/arm-cs-tools/bin:/home/louis/pebble-dev/pebble-sdk-4.5-linux64/bin:/home/louis/pebble-dev/pebble-sdk-4.5-linux64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/Python310/Scripts/:/mnt/c/Program Files/Python310/:/mnt/c/Program Files/Python38/Scripts/:/mnt/c/Program Files/Python38/:/mnt/c/Program Files/Python39/Scripts/:/mnt/c/Program Files/Python39/:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files (x86)/PuTTY/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Python27/:/mnt/c/Python27/Scripts/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Calibre2/:/mnt/c/Users/Sandy/scoop/shims:/mnt/c/Users/Sandy/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Sandy/AppData/Local/Programs/radare2:/mnt/c/Users/Sandy/AppData/Roaming/npm:/mnt/c/Users/Sandy/AppData/Local/Microsoft/WindowsApps:/snap/bin', 'LIBGL_ALWAYS_INDIRECT': '1', 'HOME': '/home/louis', 'WT_SESSION': 'c4adac7f-8a53-4050-b1bb-0b475940217c', 'DISPLAY': '172.27.224.1:0', '_': '/home/louis/pebble-dev/pebble-sdk-4.5-linux64/.env/bin/python', 'LANG': 'C.UTF-8', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'NAME': 'DESKTOP-PSQDLD8', 'XDG_DATA_DIRS': '/usr/local/share:/usr/share:/var/lib/snapd/desktop', 'OLDPWD': '/home/louis/repos', 'PYTHONHOME': '/home/louis/.pebble-sdk/SDKs/current/sdk-core/../.env', 'NODE_PATH': '/home/louis/.pebble-sdk/SDKs/current/sdk-core/../node_modules', 'WT_PROFILE_ID': '{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}', 'SHLVL': '2', 'PWD': '/home/louis/repos/synocam_home_switch', 'WSLENV': 'WT_SESSION::WT_PROFILE_ID', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'PHONESIM_PATH': '/home/louis/pebble-dev/pebble-sdk-4.5-linux64/.env//bin/pypkjs', 'NOCLIMB': '1'}
3
+files = ['/mnt/c/Users/Sandy/repos/synocam_home_switch/wscript']
4
+hash = 4221772378543028085
5
+options = {'files': '', 'jobs': 4, 'verbose': 0, 'nocache': False, 'progress_bar': 0, 'no_groups': False, 'distcheck_args': None, 'top': '', 'sandbox': False, 'destdir': '', 'keep': 0, 'zones': '', 'debug': False, 'prefix': '/usr/local/', 'timestamp': None, 'download': False, 'force': False, 'targets': '', 'out': ''}
6
+out_dir = '/mnt/c/Users/Sandy/repos/synocam_home_switch/build'
7
+run_dir = '/mnt/c/Users/Sandy/repos/synocam_home_switch'
8
+top_dir = '/mnt/c/Users/Sandy/repos/synocam_home_switch'
9 9
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+{
2
+    "C_Cpp.errorSquiggles": "Disabled"
3
+}
0 4
\ No newline at end of file
... ...
@@ -177,70 +177,28 @@ function authenticate() {
177 177
 function get_status() {
178 178
   var response;
179 179
 
180
-  if (sid != ""){
180
+  if (sid != "") {
181 181
     status = "";
182 182
     console.log('---- get_status');
183 183
 
184 184
     var url_path = "/webapi/entry.cgi?api=SYNO.SurveillanceStation.HomeMode&version=1&method=GetInfo&_sid=" + sid;
185 185
     var method = "GET";
186 186
 
187
-    onload_function = function (xhr) { }
188
-
189
-    max_retry = 1;
190
-    xhr_to_syno(method, url_path, onload_function, max_retry);
191
-
192
-    var xhr = new XMLHttpRequest();
193
-    xhr.timeout = 3000; // time in milliseconds
194
-
195
-    xhr.open("GET", url, true);
196
-
197
-    xhr.onload = function () {
198
-      if (xhr.readyState === 4) {
199
-        retry = 0;
200
-        console.log('------Get-status request returned');
201
-        if (xhr.status == 200) {
202
-          response = JSON.parse(xhr.responseText);
203
-          if (response.success == true) {
204
-            status = response.data.on;
205
-            var message;
206
-            switch (status) {
207
-              case true:
208
-                message = "Your Home mode is ON";
209
-                break;
210
-              case false:
211
-                message = "Your Home mode is OFF";
212
-                break;
213
-              default:
214
-                message = "home mode is unknown !";
215
-            }
216
-            // Build message
217
-            var dict = {
218
-              'status': message,
219
-            };
220
-
221
-            // Send the message
222
-            Pebble.sendAppMessage(dict, function (e) {
223
-              console.log('sent');
224
-            }, function () {
225
-              console.log('failed');
226
-            });
227
-          }
228
-        } else {
229
-          console.log('------Request returned error code ' + xhr.status);
187
+    onload_function = function (xhr) {
188
+      response = JSON.parse(xhr.responseText);
189
+      if (response.success == true) {
190
+        status = response.data.on;
191
+        var message;
192
+        switch (status) {
193
+          case true:
194
+            message = "Your Home mode is ON";
195
+            break;
196
+          case false:
197
+            message = "Your Home mode is OFF";
198
+            break;
199
+          default:
200
+            message = "home mode is unknown !";
230 201
         }
231
-      }
232
-    }
233
-
234
-    xhr.ontimeout = function (e) {
235
-      retry++;
236
-      if (retry <= 1) {
237
-        console.log('------Get-Status timed out retrying another time ');
238
-        get_status();
239
-      } else {
240
-        console.log('------Get-Status timed out a second time');
241
-        //send back "timeout" to watch
242
-        message = "Get-Status timed out, verify settings and connectivity";
243
-
244 202
         // Build message
245 203
         var dict = {
246 204
           'status': message,
... ...
@@ -255,9 +213,8 @@ function get_status() {
255 213
       }
256 214
     }
257 215
 
258
-    xhr.send();
259
-
260
-
216
+    max_retry = 10;
217
+    xhr_to_syno(method, url_path, onload_function, max_retry);
261 218
 
262 219
   } else {
263 220
     authenticate();
... ...
@@ -270,92 +227,84 @@ function get_status() {
270 227
 function switch_home(bool) {
271 228
   var response;
272 229
   console.log('---- authenticate');
273
-  if (sid != ""){
230
+  if (sid != "") {
274 231
     status = "";
275 232
     console.log('---- get_status');
276
-    if (JSON.parse(localStorage.getItem('clay-settings')).server) {
277
-      var server = JSON.parse(localStorage.getItem('clay-settings')).server;
278
-      var xhr = new XMLHttpRequest();
279
-
280
-      url = server + "/webapi/entry.cgi?api=SYNO.SurveillanceStation.HomeMode&version=1&method=GetInfo&_sid="+sid;
281
-
282
-      xhr.open("GET", url,false);
283
-      xhr.send();
284
-
285
-      if(xhr.status == 200) {
286
-        response = JSON.parse(xhr.responseText);
287
-        if (response.success == true){
288
-          status = response.data.on;
289
-          console.log('------ status:'+status);
290
-          var message;
291
-          var dict;
292
-          if ( status != bool){
293
-            console.log('---- switching home mode to '+ bool);
294
-            url = server + "/webapi/entry.cgi?api=SYNO.SurveillanceStation.HomeMode&version=1&method=Switch&on="+bool+"&_sid="+sid;
295
-
296
-            xhr.open("GET", url,false);
297
-            xhr.send();
298
-
299
-            if(xhr.status == 200) {
300
-              response = JSON.parse(xhr.responseText);
301
-              if (response.success == true){
302
-                status=bool;
303
-                switch (status) {
304
-                  case true:
305
-                    message = "You just set Home mode ON";
306
-                    break;
307
-                  case false:
308
-                    message = "You just set Home mode OFF";
309
-                    break;
310
-                  default:
311
-                    message = "something happened, try again !";
312
-                }
313
-                // Build message
314
-                dict = {
315
-                  'status': message,
316
-                };
317
-
318
-                // Send the message
319
-                Pebble.sendAppMessage(dict, function(e) {
320
-                  console.log('sent');
321
-                }, function() {
322
-                  console.log('failed');
323
-                });
233
+    url_path = "/webapi/entry.cgi?api=SYNO.SurveillanceStation.HomeMode&version=1&method=GetInfo&_sid=" + sid;
234
+    var method = "GET";
235
+
236
+    onload_status_function = function (xhr) {
237
+      response = JSON.parse(xhr.responseText);
238
+      if (response.success == true) {
239
+        status = response.data.on;
240
+        console.log('------ status:' + status);
241
+        var message;
242
+        var dict;
243
+        if (status != bool) {
244
+          console.log('---- switching home mode to ' + bool);
245
+          url_path = "/webapi/entry.cgi?api=SYNO.SurveillanceStation.HomeMode&version=1&method=Switch&on=" + bool + "&_sid=" + sid;
246
+          method = "GET"
247
+          onload_switch_function = function (xhr) {
248
+            response = JSON.parse(xhr.responseText);
249
+            if (response.success == true) {
250
+              status = bool;
251
+              switch (status) {
252
+                case true:
253
+                  message = "You just set Home mode ON";
254
+                  break;
255
+                case false:
256
+                  message = "You just set Home mode OFF";
257
+                  break;
258
+                default:
259
+                  message = "something happened, try again !";
324 260
               }
325
-            }else {
326
-              console.log('------Request returned error code ' + xhr.status.toString());
327
-            }
328
-          }else{
329
-            console.log('---- nothing to do, status already '+status);
330
-            switch (status) {
331
-              case true:
332
-                message = "Your Home Mode is already ON";
333
-                break;
334
-              case false:
335
-                message = "Your Home Mode is already OFF";
336
-                break;
337
-              default:
338
-                message = "something happened, try again !";
261
+              // Build message
262
+              dict = {
263
+                'status': message,
264
+              };
265
+
266
+              // Send the message
267
+              Pebble.sendAppMessage(dict, function (e) {
268
+                console.log('sent');
269
+              }, function () {
270
+                console.log('failed');
271
+              });
339 272
             }
340
-            // Build message
341
-            dict = {
342
-              'status': message,
343
-            };
344
-
345
-            // Send the message
346
-            Pebble.sendAppMessage(dict, function(e) {
347
-              console.log('sent');
348
-            }, function() {
349
-              console.log('failed');
350
-            });
351 273
           }
274
+          max_retry = 10;
275
+          xhr_to_syno(method, url_path, onload_switch_function, max_retry);
276
+
277
+        } else {
278
+          console.log('---- nothing to do, status already ' + status);
279
+          switch (status) {
280
+            case true:
281
+              message = "Your Home Mode is already ON";
282
+              break;
283
+            case false:
284
+              message = "Your Home Mode is already OFF";
285
+              break;
286
+            default:
287
+              message = "something happened, try again !";
288
+          }
289
+          // Build message
290
+          dict = {
291
+            'status': message,
292
+          };
293
+
294
+          // Send the message
295
+          Pebble.sendAppMessage(dict, function (e) {
296
+            console.log('sent');
297
+          }, function () {
298
+            console.log('failed');
299
+          });
300
+
352 301
         }
353
-      }else {
354
-        console.log('------Request returned error code ' + xhr.status.toString());
355 302
       }
356
-    }else{
357
-      Pebble.showSimpleNotificationOnPebble("DSCam H-S", "You need to set your Synology account and server.");
358 303
     }
304
+
305
+    max_retry = 10;
306
+    xhr_to_syno(method, url_path, onload_status_function, max_retry);
307
+
359 308
   } else {
360 309
     authenticate();
361 310
     switch_home(bool);
... ...
@@ -364,16 +313,16 @@ function switch_home(bool) {
364 313
 }
365 314
 
366 315
 // Get JS readiness events
367
-Pebble.addEventListener('ready',function(e){
316
+Pebble.addEventListener('ready', function (e) {
368 317
   console.log("---- local storage:");
369 318
   console.log("user " + JSON.parse(localStorage.getItem('clay-settings')).username);
370 319
   console.log('PebbleKit JS is ready');
371 320
   // Update Watch on this
372
-  Pebble.sendAppMessage({'JSReady':1});
321
+  Pebble.sendAppMessage({ 'JSReady': 1 });
373 322
 });
374 323
 
375 324
 // Get AppMessage events
376
-Pebble.addEventListener('appmessage', function(e) {
325
+Pebble.addEventListener('appmessage', function (e) {
377 326
   // Get the dictionary from the message
378 327
   var dict = e.payload;
379 328
   console.log(dict[0].toString());
... ...
@@ -391,7 +340,7 @@ Pebble.addEventListener('appmessage', function(e) {
391 340
       switch_home(false);
392 341
       break;
393 342
     default:
394
-      console.log('Sorry. I don\'t understand your request :'+ dict[0]);
343
+      console.log('Sorry. I don\'t understand your request :' + dict[0]);
395 344
   }
396 345
 
397
-});
346
+});
398 347
\ No newline at end of file