Debounce $.set on Chrome. Should help #1018.

This commit is contained in:
Nicolas Stepien 2013-04-26 02:07:57 +02:00
parent 91d6c50604
commit d32e9c8ef6

View File

@ -232,12 +232,22 @@ $.get = (key, val, cb) ->
items = key items = key
cb = val cb = val
chrome.storage.sync.get items, cb chrome.storage.sync.get items, cb
$.set = (key, val) -> $.set = do ->
items = if typeof key is 'string' items = {}
$.item key, val
else set = $.debounce 500, ->
key try
chrome.storage.sync.set items chrome.storage.sync.set items
items = {}
catch err
c.error err
(key, val) ->
if typeof key is 'string'
items[key] = val
else
$.extend items, key
set()
<% } else if (type === 'userjs') { %> <% } else if (type === 'userjs') { %>
do -> do ->
# http://www.opera.com/docs/userjs/specs/#scriptstorage # http://www.opera.com/docs/userjs/specs/#scriptstorage