HelloLinkon
HelloLinkon

Reputation: 348

setTimeout and setInterval not working in Firefox OS

In Firefox OS setTimeout and setInterval method does not support for Firefox OS content security policy ( https://developer.mozilla.org/Apps/CSP ). But if i want to use this type of method then what will be the process instead of this method.

Upvotes: 2

Views: 1582

Answers (1)

Khanh Nguyen
Khanh Nguyen

Reputation: 11134

"Dynamic code execution with setTimeout and setInterval is banned"

"You MUST pass callable objects (i.e.: functions) to the setTimeout and setInterval functions. Passing strings will not create the timer and the function will return 0."

It doesn't disallow setTimeout and setInterval. It only bans passing strings to them, ie the following won't work

setTimeout('x = 5', 500);

but this will still work

setTimeout(function() { x = 5; }, 500);

Seriously, who would ban that?

Upvotes: 7

Related Questions