Debounce $.set on Chrome. Should help #1018.
This commit is contained in:
parent
91d6c50604
commit
d32e9c8ef6
22
lib/$.coffee
22
lib/$.coffee
@ -232,12 +232,22 @@ $.get = (key, val, cb) ->
|
||||
items = key
|
||||
cb = val
|
||||
chrome.storage.sync.get items, cb
|
||||
$.set = (key, val) ->
|
||||
items = if typeof key is 'string'
|
||||
$.item key, val
|
||||
else
|
||||
key
|
||||
chrome.storage.sync.set items
|
||||
$.set = do ->
|
||||
items = {}
|
||||
|
||||
set = $.debounce 500, ->
|
||||
try
|
||||
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') { %>
|
||||
do ->
|
||||
# http://www.opera.com/docs/userjs/specs/#scriptstorage
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user