NoSleep.js
NoSleep.js copied to clipboard
Not compatiable with jQuery handler function
Documentation Is:
- [ ] Missing
- [ ] Needed
- [ ] Confusing
- [x ] Not Sure?
Please Explain in Detail...
Howdy! I think NoSleep.js doesn't work with with a jQuery click event when a handler reference is used rather than an anonymous function (I hope I got those terms right :-P ).
E.g.
Doesn't work (NoSleep.enable() is in the start_ex_wizard function) $('#start-link').click(start_ex_wizard);
Does work $('#start-link').click(function(){ NoSleep.enable(); // Prevent device from sleeping start_ex_wizard(); });
Your Proposal for Changes
I thought you might like to add a note to the readme.md so others are aware. Alternatively I could document it on StackOverflow.
Not sure if it is related, but I am trying to use it with AngularJS and I cannot make it work. I added it in an ng-click
controller function and as soon as noSleep.enable()
is called, the CPU goes up to 170%. The angular event handler also uses jquery that's why I thought it might be a similar case.