Skip to content

Instantly share code, notes, and snippets.

Avatar

Felippe Nardi felippenardi

View GitHub Profile
View machine.js
var contentEditorMachine = Machine({
id: 'content',
strict: true,
initial: 'unknown',
context: {
variants: [
{ id: '1', status: 'draft' },
{ id: '2', status: 'live' },
],
currentVariant: {
View machine.js
var contentEditorMachine = Machine({
id: 'content',
strict: true,
initial: 'unknown',
on: {
CLEAR_ERROR: {
actions: 'clearError'
}
},
context: {
View machine.js
const editingMachine = Machine({
id: 'editing',
initial: 'editing',
states: {
editing: {
id: 'live',
on: {
SAVE_CHANGES: 'saving',
DISCARD_CHANGES: 'confirmingDiscard'
}
View machine.js
var variantEditorMachine = Machine({
id: 'editing',
initial: 'editing',
states: {
editing: {
id: 'live',
on: {
SAVE_CHANGES: 'saving',
DISCARD_CHANGES: 'confirmingDiscard'
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@felippenardi
felippenardi / home.json
Last active Sep 4, 2019
git.io/home-json-example
View home.json
{
"store.home": {
"blocks": [
"info-card#principal",
"info-card#bottom",
"shelf"
]
},
"info-card#principal": {
View machine.js
const twoFactorMachine = {
two_factor: {
id: 'two_factor',
onEntry: ['checkTwoFactorSettings'],
initial: 'unknown',
states: {
unknown: {
on: {
'': [
{ target: 'setup', cond: 'needsToSetupTwoFactor' },
You can’t perform that action at this time.