簡介 (Summary)
Nucleoid是基於Promise的一個流程控制系統,早期目的就是為了處裡server less中cloud function太難追蹤堆棧和錯誤的問題,但現在它具有一個完整的生命週期與友善的非同步操作、堆棧追蹤等,能協助各種模式。
安裝 (Install)
html
<script src="https://khc-zhihao.github.io/Nucleoid/dist/index.js"></script>
webpack
import Nucleoid from 'nucleoid'
node
npm i nucleoid
開始 (How to use?)
const Nucleoid = require('nucleoid')
Nucleoid.createGene('my first gene', {
templates: {
'first template': (base, enzy, next, exit, fail) => {
base.start = true
next()
},
'next template': (base, enzy, next, exit, fail) => {
base.next = true
next()
}
}
}).transcription().then((messenger) => {
console.log(messenger.base.start) // true
})