Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Build warning on document.onload=

 

I try to apply the navigation pattern described in this sample app:

https://github.com/Fitbit/sdk-app-demo 

When I build it there is any warning, but when I build my app (https://github.com/alessandroame/F3KBit/tree/stopwatch) this is the output:

 

[16:58:24][warn][app] app\index.js (18:0) Illegal reassignment to import 'document'
    16: }
    17:
    18: document.onload=()=>{
        ^
    19:   document.error("document.onload");
    20: }
[16:58:24][warn][app] app\index.js (21:0) Illegal reassignment to import 'document'
    19:   document.error("document.onload");
    20: }
    21: document.onreload=()=>{
        ^
    22:   document.error("document.onREload");
    23: }
[16:58:24][warn][app] app\views\launchTrigger.js (45:2) Illegal reassignment to import 'document'
    43:   trigger.start();
    44:
    45:   document.onbeforeunload=(evt)=>{
          ^
    46:     trigger.stop();
    47:   };
[16:58:24][warn][app] app\views\landingTrigger.js (45:2) Illegal reassignment to import 'document'
    43:   }, 50);
    44:
    45:   document.onbeforeunload=(evt)=>{
          ^
    46:     evt.preventDefault();
    47:     return false;

 

 

 

What is the reason for the warnings?

Best Answer
0 Votes
2 REPLIES 2

Dont you hate it when no-one replies.
As far as I cant see, they (fitdev) have locked down some functions. Those functions had too much power earlier on, so they're trying to pull back on the dev being able to interact directly with the document model. I -like you-, like the ability to ensure I dont accidentally exit the app. I've added a confirmation box on my exit app procedure, so I can confirm that I was meant to exit... I personally liked the buttons earlier on too as I was far less likely to accidentally press the buttons that knocking the screen.

Best Answer
0 Votes

Hi @alessandroame - it could be document.onload has been deprecated. .onunload still exists.

Author | ch, passion for improvement.

Best Answer
0 Votes