vue-use-chrome-storage
v1.1.3
Published
Chrome storage hook for vue3
Downloads
8
Readme
vue-use-chrome-storage
This package is used to integrate the chrome storage with the vue framework through this hook.
Install
npm i vue-use-chrome-storage
Example Usage
<template>
<button
@click="onClick"
>
Hide
</button>
<p v-if="chromeStorage.state.visible">
Visible
</p>
</template>
<script setup lang="ts">
import { useChromeStorage } from 'vue-use-chrome-storage';
const chromeStorage = useChromeStorage({
id: 'visible',
defaultState: {
visible: true
},
storageArea: 'local'
});
const onClick = () => {
chromeStorage.state.visible = !chromeStorage.state.visible;
};
</script>
Remark
- Works only with objects in store.
- Not fully tested
- Not tested with a managed store type
- Error catching was also not tested