Skip to content

Instantly share code, notes, and snippets.

View ishabo's full-sized avatar

Joshua ishabo

  • YodaTek LTD
  • London
View GitHub Profile
@ishabo
ishabo / machine.js
Last active October 10, 2019 17:59
Generated by XState Viz: https://xstate.js.org/viz
const fetchProjections = amount =>
new Promise((resolve, reject) => {
console.log('Fetching ', amount);
const projections = {monthlyEstimate: 120, maxAge: 80};
resolve(projections);
});
const validateInput = (input, mimimum) =>
new Promise((resolve, reject) => {
if (input >= mimimum) {
@ishabo
ishabo / machine.js
Created October 10, 2019 17:39
Generated by XState Viz: https://xstate.js.org/viz
const fetchProjections = amount =>
new Promise((resolve, reject) => {
console.log('Fetching ', amount);
const projections = {monthlyEstimate: 120, maxAge: 80};
resolve(projections);
});
const validateInput = (input, mimimum) =>
new Promise((resolve, reject) => {
if (input >= mimimum) {
@ishabo
ishabo / machine.js
Last active October 10, 2019 18:15
Generated by XState Viz: https://xstate.js.org/viz
const fetchProjections = amount =>
new Promise((resolve, reject) => {
console.log('Fetching ', amount);
const projections = {monthlyEstimate: 120, maxAge: 80};
resolve(projections);
});
const validateInput = (input, mimimum) =>
new Promise((resolve, reject) => {
if (input >= mimimum) {
@ishabo
ishabo / machine.js
Created October 11, 2019 16:30
Generated by XState Viz: https://xstate.js.org/viz
const todoMachine = Machine({
id: "todo",
initial: "reading",
context: {
id: undefined,
title: "",
prevTitle: ""
},
on: {
TOGGLE_COMPLETE: {
@ishabo
ishabo / machine.js
Last active October 14, 2019 17:42
Generated by XState Viz: https://xstate.js.org/viz
const getPot = (ctx) => {
if (!ctx.currentPot) {
// throw new Error(
// 'Attempted to get currentPot from illustration machien context but it was not set',
// );
return {};
}
return ctx.pots[ctx.currentPot];
};
const updatePot = (obj, e) => assign({
@ishabo
ishabo / machine.js
Created October 14, 2019 12:34
Generated by XState Viz: https://xstate.js.org/viz
"use strict";
// const services = {
// validateInput: (ctx: IPotContext) =>
// validateInput(ctx.allocatedAmount, ctx.minimumAmountAllowed),
// fetchProjections: (ctx: IPotContext): Pormise<IProjections> => fetchProjections(ctx.allocatedAmount),
// };
const getPot = (ctx) => {
if (!ctx.currentPot) {
throw new Error('Attempted to get currentPot from illustration machien context but it was not set');
}
@ishabo
ishabo / machine.js
Last active October 21, 2019 16:17
Generated by XState Viz: https://xstate.js.org/viz
"use strict";
const defaultContext = {
totalSavings: 10000,
taxFreeLumpSum: 0,
latestPot: '',
availableSavings: 0,
pots: {
flexibleIncomePot: {
potName: 'flexibleIncomePot',
potType: 'income',
@ishabo
ishabo / machine.js
Last active February 17, 2020 14:30
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ishabo
ishabo / machine.js
Created February 17, 2020 17:06
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ishabo
ishabo / machine.js
Last active February 24, 2020 14:31
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions