![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
更加自动和简洁的实现状态的迁移。
npm install -g afsm
import { FSM,From,To } from 'afsm'
class MyFSM extends FSM {
@From('')
@To('state1')
async gotoState1() {
}
@From('state1')
@To('state2')
async gotoState2() {
}
}
const obj = new MyFSM()
obj.gotoState2()//will throw error
obj.gotoState1().then(()=>{//will change to state1
return obj.gotoState2()//then change to state2
})
每一种状态变更时,都会进入变更中的状态,当异步函数返回后才会使得状态变更成功,同时发出事件。
const obj = new MyFSM()
obj.on('state2',(oldState) => {
console.log(obj,'is state2 now')
})
import { AFSM } from 'afsm'
const afsm = new AFSM()
afsm.start().then(() => {
//do something after start
return afsm.stop()
}).then(()=>{
//do something after stop
})
原子状态机有两种基本状态,即ON和OFF。可以用原子状态机组合成复杂的状态。 在start和stop中间是异步变更中的状态,所以一共有4种状态。
stateDiagram-v2
[*] --> connecting : connect
connecting --> connected : connect success
connecting --> [*] : connect failed
disconnected --> reconnecting : reconnect
reconnecting --> reconnected : reconnect success
reconnecting --> disconnected : reconnect failed
connected --> disconnected : disconnect
connecting --> disconnected : disconnect
[*] --> disconnected : disconnect
reconnected --> disconnected : disconnect
reconnecting --> disconnected : disconnect
disconnected --> disconnected : disconnect
disconnecting --> disconnected : disconnect
FAQs
automatic finite state machine
The npm package afsm receives a total of 3 weekly downloads. As such, afsm popularity was classified as not popular.
We found that afsm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.