Skip to content

Instantly share code, notes, and snippets.

@tmlangley
tmlangley / machine.js
Created September 17, 2020 19:55
Generated by XState Viz: https://xstate.js.org/viz
const ResultsMachine = Machine(
{
id: 'resultsMachine',
initial: 'waiting',
context: {
responseData: null,
filterParams: null,
error: '',
},
states: {
@tmlangley
tmlangley / machine.js
Created September 17, 2020 16:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tmlangley
tmlangley / machine.js
Created April 30, 2020 15:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tmlangley
tmlangley / machine.js
Last active April 23, 2020 19:17
Generated by XState Viz: https://xstate.js.org/viz
const defaultComparison = (context, event) => context.filterData !== event.value;
const createFilterMachine = (id, applyTransformer, compareFn = defaultComparison) => Machine({
id,
context: {
filterData: null,
valueChanged: false,
},
initial: 'idle',
@tmlangley
tmlangley / machine.js
Created April 21, 2020 16:33
Generated by XState Viz: https://xstate.js.org/viz
const createFilterMachine = (id, applyTransformer) => Machine({
id,
context: {
filterData: {}
},
initial: 'idle',
states: {
idle: {
on: {
OPEN: 'editing',
@tmlangley
tmlangley / machine.js
Created April 15, 2020 18:52
Generated by XState Viz: https://xstate.js.org/viz
const FiltersMachine = Machine({
id: 'filters',
initial: 'loading',
context: {
results: [],
filterParams: []
},
states: {
loading: {
initial: 'fetchingAllFilterOptions',
@tmlangley
tmlangley / machine.js
Created April 15, 2020 18:51
Generated by XState Viz: https://xstate.js.org/viz
const ResultsMachine = Machine({
id: 'resultsMachine',
initial: 'defaultContent',
states: {
defaultContent: {
on: {
REFINING_FILTERS: 'loading'
}
},
loading: {
@tmlangley
tmlangley / machine.js
Last active April 15, 2020 18:39
Generated by XState Viz: https://xstate.js.org/viz
const FiltersMachine = Machine({
id: 'filters',
initial: 'loading',
context: {
results: [],
filterParams: []
},
states: {
loading: {
initial: 'fetchingAllFilterOptions',
@tmlangley
tmlangley / machine.js
Created March 19, 2020 16:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tmlangley
tmlangley / buttercal-usage.md
Created June 11, 2017 20:20
ButterCal usage ideas

link custom UI

myCal = new ButterCal({
	defaultUI: false
});

myCal.linkUI({
	nextMonth: document.querySelector('.next-month'),
	prevMonth: document.querySelector('.prev-month'),