Skip to content

Commit c1caed8

Browse files
feat(overmind): change to send instead of transition
1 parent 1726e20 commit c1caed8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/node_modules/overmind/src/statemachine.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Statemachine', () => {
4646
current: 'FOO'
4747
})
4848
const transition: Action = ({ state }) => {
49-
state.transition('TOGGLE')
49+
state.send('TOGGLE')
5050
}
5151

5252
const config = {
@@ -84,7 +84,7 @@ describe('Statemachine', () => {
8484
current: 'FOO'
8585
})
8686
const transition: Action = ({ state }) => {
87-
state.transition('TOGGLE')
87+
state.send('TOGGLE')
8888
}
8989

9090
const config = {
@@ -123,7 +123,7 @@ describe('Statemachine', () => {
123123
})
124124

125125
const transition: Action = ({ state }) => {
126-
state.transition('TOGGLE')
126+
state.send('TOGGLE')
127127
}
128128

129129
const config = {

packages/node_modules/overmind/src/statemachine.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import isPlainObject from 'is-plain-obj'
21
import { PATH, VALUE } from 'proxy-state-tree'
32

43
import { deepCopy } from './utils'
@@ -24,7 +23,7 @@ export interface MachineMethods<States extends TState, Events extends TEvents> {
2423
matches<T extends States["current"]>(
2524
current: T,
2625
): Statemachine<States extends { current: T} ? States : never, Events> | undefined
27-
transition<T extends Events["type"]>(
26+
send<T extends Events["type"]>(
2827
...args: Events extends { type: T, data: any } ? [T, Events["data"]] : [T]
2928
): Statemachine<States extends { current: T} ? States : never, Events> | undefined
3029
}
@@ -59,7 +58,7 @@ export class StateMachine<State extends TState, Events extends TEvents> {
5958
this[TRANSITIONS] = transitions
6059
Object.assign(this, state)
6160
}
62-
transition(type, data) {
61+
send(type, data) {
6362
if (this[VALUE][IS_DISPOSED]) {
6463
if (process.env.NODE_ENV === 'development') {
6564
console.warn(`Overmind - The statemachine at "${this[PATH]}" has been disposed, but you tried to transition on it`)

0 commit comments

Comments
 (0)