Package Exports
- share-localstorage
- share-localstorage/dist/main.es.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (share-localstorage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
share-localstorage
<head>
<script src="https://cdn.jsdelivr.net/npm/share-localstorage@1.1.3/dist/main.iife.js"></script>
</head>
<body>
<script>
console.log(window.shareLocalstorage);
</script>
</body>
import shareLocalstorage from "share-localstorage";
or;
const shareLocalstorage = require("share-localstorage");
Promise method
- init([src? string])
- destory()
- getItem(keyName string)
- setItem(keyName string, keyValue string)
- removeItem(keyName string)
shareLocalstorage
.init()
.then(() => {
return shareLocalstorage.setItem("test5", "test5");
})
.then((set) => {
console.log({ set });
return shareLocalstorage.getItem("test5");
})
.then((get) => {
console.log({ get });
return shareLocalstorage.removeItem("test5");
})
.then((remove) => {
console.log({ remove });
return shareLocalstorage.getItem("test5");
})
.then((get) => {
console.log({ get });
return shareLocalstorage.destory();
})
.catch(console.error);