0.0.5 • Published 6 years ago

zcoil v0.0.5

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

Zcoil is a model layer framework for more convenient and elegant data manipulation

Currently only Chinese documents are available

中文文档

The demo uses queues to execute methods

https://channg.github.io/zcoil/demo.html

npm i zcoil

Instantiated object

var z = new zcoil()

initialization with param

z.init({
  data() {
    return {
      message: "hello world "
    }
  },
  asyncGetSaySomething(param) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve(param)
      }, 1000)
    })
  },
  say(param) {
    this.asyncGetSaySomething(param).then((say) => {
      this.message += "," + say
    })
  },
  endToSay(){
    this.message += ",come on "
  }
})

Magical method call process with$coil()

var hl = z.$coil().say("Thank your star this project")

hl = hl.endToSay()

hl  = hl.say("It works really well")

hl.exec((data)=>{
  data.message  //"hello world ,Thank your star this project,come on ,It works really well" 
  z.message     //"hello world ,Thank your star this project,come on ,It works really well" 
})

You can use the $watch method to get the data before the $coil method is executed

z.$watch((from,to)=>{
  console.log(from.message)
  console.log(to.message)
})

try it in jsfiddle

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago