V
V
vladkens2013-11-01 22:41:42
JavaScript
vladkens, 2013-11-01 22:41:42

Saving state between extension calls on execution

There is an extension for Google Chrome with background scripts that have persistent = false, i.e. causes scripts to execute only if some event occurs, I have it chrome.alarms. While the script is running, some actions occur. I need to persist a javascript object between calls to a script. Actually the question is how to do it.

An object of type webkitNotifications. I tried to use a special API for notifications in extensions, but it is somewhat raw (for a long time unread messages, the button click handler is lost, and there is no way to set the notification time).

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rozhik, 2013-11-01
@vladkens

Need a translation?
developer.chrome.com/extensions/storage.html
Best practices when using event pages

If you need to keep runtime state in memory throughout a browser session, use the storage API or IndexedDB. Since the event page does not stay loaded for long, you can no longer rely on global variables for runtime state.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question