0.0.3 • Published 2 years ago

backup-state v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Backup State

Easily create backup and restore buttons.

Installation

npm i backup-state

Backup

<script setup="">
  import {backup} from 'backup-state'

  const data = {
    name: 'Zen',
    location: 'Indonesia'
  }
</script>

<template>
  <button @click='backup(data, "data.txt")'>backup</button>
</template>

Restore

<script setup="">
  import {restore} from 'backup-state'
  import {ref} from 'vue'
  
  const data = ref({})

  async function getNow(){
    data.value = await restore()
  }
</script>

<template>
  <button @click='getNow'>restore</button>
</template>