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
|
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user