Jan Jongboom <[email protected]> writes:
> I have the following code running in system:
>
> var _iv;
>
> navigator.requestWakeLock('cpu');
> navigator.requestWakeLock('screen');
> navigator.requestWakeLock('wifi');
Use
var lock = navigator.requestWakeLock('cpu');
otherwise the lock is unlocked when GC'ed. Also remember to call
lock.unlock() when done using them.
> window.on('online', () => {
> _iv = setInterval(ping, 1500);
> });
> window.on('offline', () => clearInterval(_iv));
>
> function ping() {
> var x = new XMLHttpRequest({ mozSystem: true });
> x.open('GET', 'http://janjongboom.com/yolo123?' + (+new Date));
> x.send();
> }
>
> When I now turn off the screen via |navigator.mozPower.screenEnabled = false|
> it will stop executing my code anyway (need to not be connected to USB). It
> also does not show up anymore in ADB when I re-plug it into USB...
>
> What am I missing?
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g