2.0.0-alpha.1 • Published 4 years ago

vue-chronos v2.0.0-alpha.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

vue-chronos

Lightweight promise-based loading controller for Vue.js

NPM

Demo

Basic usage

Usage

npm install vue-chronos
import Vue from 'vue'
import Chronos from 'vue-chronos'

Vue.use(Chronos, {
  getterName: '$chronos',
  optionName: 'chronos',
})

export default {
  data () {
    return {
      form: {
        selectA1: 'a',
        selectA2: null,
        selectB1: null,
        selectB2: null,
      },
      optionsA1: ['a', 'b'],
      optionsA2: [],
      optionsB1: ['a', 'b'],
      optionsB2: [],
    }
  },

  watch: {
    async 'form.selectA1' () {
      const promise = new Promise(resolve => {
        setTimeout(() => {
          this.optionsA2 = ['c', 'd']
          this.optionsB2 = ['c', 'd']
          resolve()
        }, 1000)
      })

      await this.$chronos.$load('form.selectA1', promise)
    },
  },

  chronos () {
    return [
      ['form.selectA1', 'form.selectA2'],
      ['form.selectB1', 'form.selectA2'],
      ['form.selectA1', 'form.selectB2'],
      ['form.selectB1', 'form.selectB2'],
    ]
  },
}

API

Variables

  1. $sending
  2. $receiving
  3. $pending

Methods

  1. $load (path, promise)
2.0.0-alpha.1

4 years ago

2.0.0-alpha

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago