Goibon
Goibon

Reputation: 251

Getting your script to run repeatedly at intervals?

I am working on an extension that retrieves tweets and I want it to do this at certain intervals, but after reading Google's Content Security Policy Documentation it seems it is no longer possible to simply use:

setInterval(someFunction, interval);

So how would one go about doing this?

Upvotes: 0

Views: 140

Answers (1)

Travis
Travis

Reputation: 12379

Google's Content Security Policy prevents you passing a string as the first argument in setInterval. You should have no problem passing a function.

The reason for this is they want to avoid evaluated JavaScript. Passing a function as a string forces that string to be evaluated similar to using eval(). See this previously asked question on why eval() can be a security issue.

Upvotes: 2

Related Questions