0.0.1 • Published 4 years ago

cipher-restoration-mixins v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

import

import { restoration } from 'cipher-restoration-mixins'

apply

export default {
    ...
    mixins: [restoration],
    ...
}

save

this.saveRestorationState(data);

load

const data = this.loadRestorationState();

example

export default {
    ...
    watch: {
      data: {
        handler: function (newValue, oldValue) {
          this.saveRestorationState(newValue);
          const object = this.transformation(newValue);
          this.$emit("update", object);
        },
        deep: true,
        immediate: true,
      },
    },
    methods: {
      transformation(data) {
        return ...
      },
      reset() {
        const data = this.loadRestorationState();
        const _data = this.transformation(data);
        this.$emit("update", _data);
      },
    },
    ...
}
0.0.1

4 years ago