Created
May 27, 2020 04:56
-
-
Save coodoo/eedf84a9be3fd6dc6195adff0a772367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
id: 'Root', | |
initial: 'after map loaded', | |
states: { | |
'before map loaded': { | |
on: {}, | |
states: {} | |
}, | |
'after map loaded': { | |
on: {}, | |
states: { | |
'route color': { | |
on: {}, | |
states: {} | |
}, | |
'map style': { | |
on: {}, | |
states: {} | |
}, | |
'gpx upload': { | |
on: {}, | |
states: { | |
pending: { | |
on: {}, | |
states: {} | |
}, | |
failure: { | |
on: {}, | |
states: {} | |
}, | |
success: { | |
on: {}, | |
states: {}, | |
type: 'parallel' | |
} | |
} | |
} | |
}, | |
type: 'parallel', | |
initial: 'route color' | |
} | |
}, | |
on: {} | |
} |
Author
coodoo
commented
May 27, 2020
將 color
與 style
放在 subMachine{}
內,這樣寫一次即可供 before load
與 after load
使用。
//
const subMachine = {
type: 'parallel',
states: {
'route color': {
on: {},
states: {}
},
'map style': {
on: {},
states: {}
}
}
}
//
const main = {
id: 'Root',
initial: 'before map loaded',
states: {
'before map loaded': {
on: {},
states: {}
},
'after map loaded': {
initial: 'route color',
on: {},
states: {
loading: {
on: {},
states: {
pending: {
on: {},
states: {}
},
failure: {
on: {},
states: {}
},
success: {
on: {},
states: {},
}
}
},
'before load': {
on: {},
states: subMachine
},
'after load': {
on: {},
states: subMachine
}
}
}
},
on: {}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment