How to store Set object in chrome local storage

前端 未结 2 1247
小蘑菇
小蘑菇 2021-01-19 06:12
var testSet = new Set(); testSet.add(1); testSet.add(2);
chrome.storage.local.set( { \'key\': testSet }, function() { chrome.storage.local.get( \'key\', function(dat         


        
2条回答
  •  误落风尘
    2021-01-19 06:25

    From the chrome API docs:

    StorageArea.get(string or array of string or object keys, function callback)
    

    So it looks like you can only use primitives and objects containing primitives.

提交回复
热议问题