Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我可以像使用本地存储一样使用Amplify.js吗?_Javascript_Html_Polyfills - Fatal编程技术网

Javascript 我可以像使用本地存储一样使用Amplify.js吗?

Javascript 我可以像使用本地存储一样使用Amplify.js吗?,javascript,html,polyfills,Javascript,Html,Polyfills,这里有人在非HTML5浏览器上使用过Amplify.js作为本地存储回退吗?。我需要知道你是否可以用与localstorage相同的方式使用它。例如,我可以通过使用length对象获得localstorage的大小,例如amplify.store.length还可以通过每个键使用amplify.js单步执行我的localstorage,例如amplify.store.key(I)其中i是一个数字,它是存储项的索引 amplify.store是对同步持久存储的抽象,因此它有意不具有与localSt

这里有人在非HTML5浏览器上使用过Amplify.js作为本地存储回退吗?。我需要知道你是否可以用与localstorage相同的方式使用它。例如,我可以通过使用length对象获得localstorage的大小,例如
amplify.store.length
还可以通过每个键使用amplify.js单步执行我的localstorage,例如
amplify.store.key(I)
其中i是一个数字,它是存储项的索引

amplify.store是对同步持久存储的抽象,因此它有意不具有与localStorage相同的API。如果您不提供任何参数,那么您将返回一个包含所有键/值对的对象,您可以通过循环来解决这两个需求

var key,
    count = 0,
    data = amplify.store();
for ( key in data ) {
    // calculate the count
    count++;
    // or do something with the data
    console.log( key, "is", data[ key ] );
}
console.log( "There are", count, "items in the store." );

amplify.store是对同步持久存储的抽象,因此它有意不具有与localStorage相同的API。如果您不提供任何参数,那么您将返回一个包含所有键/值对的对象,您可以通过循环来解决这两个需求

var key,
    count = 0,
    data = amplify.store();
for ( key in data ) {
    // calculate the count
    count++;
    // or do something with the data
    console.log( key, "is", data[ key ] );
}
console.log( "There are", count, "items in the store." );

好的,我可能只是用cookies作为一个后备,我以为我不必写任何新代码。好的,我可能只是用cookies作为后备,我以为我不必写任何新代码。