Skip to content

Instantly share code, notes, and snippets.

@mukeshsoni
mukeshsoni / machine.js
Last active March 11, 2021 12:27
Generated by XState Viz: https://xstate.js.org/viz
// sketch-systems like statechart description
// docusign
// start*
// SELECT_DOCUMENT -> detailspane
// detailspane
// is_versioned*
// -> versioned; isVersioned
// -> unversioned; isNotVersioned
// versioned
@mukeshsoni
mukeshsoni / machine.js
Last active March 2, 2021 05:00
Generated by XState Viz: https://xstate.js.org/viz
// sketch-systems like statechart description
// docusign
// detailspane*
// is_versioned*
// -> versioned; isVersioned
// -> unversioned; isNotVersioned
// versioned
// CLICK_SIGN_BUTTON -> #docusign.modal
// unversioned
Docusign
Detailspane*
Check versioned or not?
is versioned? -> Versioned
is not versioned? -> Unversioned
Versioned
Click sign button -> Modal
Unversioned
click enable versioning -> Versioned
Modal
@mukeshsoni
mukeshsoni / SketchSystems.spec
Last active March 12, 2020 12:02
Phone Number section
Phone Number section
Add phone number
Add button disabled*
input phone number -> Check phone input
Add button enabled
input phone number -> Check phone input
click add -> Verify phone number
Check phone input
input empty? -> Add button disabled
input not empty? -> Add button enabled
@mukeshsoni
mukeshsoni / SketchSystems.spec
Created December 4, 2019 08:09
# chat model
# chat model
Chat
No chats
new chat arrival -> chats loaded
chats loaded*&
selection state
nothing selected
conv selected
no dialogs open
delete dialog open
// grammar for custom text based language to describe statecharts
{
var INDENT_STEP = 2;
var indentLevel = 0;
function arrayOfObjToObj(arr) {
return arr.reduce((acc, item) => ({...acc, ...item}), {})
}
}
Chat
check conv count
conv count 0 -> no chats
* -> chats loaded
no chats
new chat arrival -> chats loaded
chats loaded*&
# transient state to select type of active conv
check active conv type
is normal conv -> active conv for normal ad
@mukeshsoni
mukeshsoni / machine.js
Last active November 10, 2019 16:46
Generated by XState Viz: https://xstate.js.org/viz
const nameList = ['Rithwik', 'Mukesh'];
function matches(ctx, e) {
return nameList.some(name => name.toLowerCase().includes(ctx.text.toLowerCase()))
}
function doesNotMatch(ctx, e) {
return !matches(ctx)
}
@mukeshsoni
mukeshsoni / machine.js
Last active November 24, 2019 12:16
Generated by XState Viz: https://xstate.js.org/viz
// Chat model
function someConvSelected(context) {
return context.selected_conv_count > 0;
}
function noConvSelected(context) {
return !someConvSelected(context);
}
@mukeshsoni
mukeshsoni / machine.js
Last active October 23, 2019 03:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions