Last active
November 3, 2020 06:10
-
-
Save oshimayoan/7cb55fd3832d17b85575b9d717c98348 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
const machine = Machine({ | |
id: 'prefetchWebView', | |
initial: 'idle', | |
context: { | |
}, | |
states: { | |
idle: { | |
on: { | |
RERENDER: 'isFileExists', | |
} | |
}, | |
isFileExists: { | |
on: { | |
YES: 'readFile', | |
NO: 'prefetch', | |
} | |
}, | |
prefetch: { | |
on: { | |
RESOLVE: 'prefetchSuccess', | |
REJECT: 'prefetchFailure', | |
} | |
}, | |
prefetchSuccess: { | |
on: { | |
SAVE: 'writeToFile' | |
} | |
}, | |
prefetchFailure: {}, | |
writeToFile: { | |
on: { | |
OPEN_WEBVIEW: 'readFile' | |
} | |
}, | |
readFile: { | |
on: { | |
SUCCESS: 'readFileSuccess', | |
FAIL: 'readFileFailure' | |
} | |
}, | |
readFileSuccess: { | |
on: { | |
RENDER_HTML: 'renderWebView' | |
} | |
}, | |
readFileFailure: { | |
on: { | |
RENDER_URL: 'renderWebView' | |
} | |
}, | |
renderWebView: { | |
type: 'final', | |
}, | |
// idle: { | |
// on: { | |
// FETCH: 'loading' | |
// } | |
// }, | |
// loading: { | |
// on: { | |
// RESOLVE: 'success', | |
// REJECT: 'failure' | |
// } | |
// }, | |
// success: { | |
// type: 'final' | |
// }, | |
// failure: { | |
// on: { | |
// RETRY: { | |
// target: 'loading', | |
// actions: assign({ | |
// retries: (context, event) => context.retries + 1 | |
// }) | |
// } | |
// } | |
// } | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment