View HasuraEventTriggerPayload.ts
This file contains 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
export type TEventTriggerPayload<TData> = { | |
event: ( | |
| TEvent<'INSERT', null, TData> | |
| TEvent<'UPDATE', TData, TData> | |
| TEvent<'DELETE', TData, null> | |
| TEvent<'MANUAL', null, TData> | |
) & { | |
session_variables: Dictionary | |
} | |
created_at: ISODateTime |
View examples.ts
This file contains 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 NoChildrenAllowed: ReactFC<NoChildren> = () => null | |
const RequireSingleChild: ReactFC<Required<SingleChild>> = () => null | |
type TProps = Required<SomeChildren> & { | |
otherProp: number | |
} | |
const RequireMoreChildrenAndOtherProps: ReactFC<TProps> = () => null |
View machine.js
This file contains 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 audioStreamMachine = Machine({ | |
id: 'audioStream', | |
initial: 'idle', | |
context: { | |
stream: null, | |
streamError: null, | |
}, | |
states: { | |
idle: { | |
on: { |
View machine.js
This file contains 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 tickEvent = (gear) => ({ type: 'TICK', gear }) | |
const trainMachine = Machine( | |
{ | |
id: 'train', | |
initial: 'inactive', | |
context: { | |
position: { | |
x: 0, | |
y: 0, |
View machine.js
This file contains 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 reset = assign({ | |
value: ({ initialValue }) => initialValue | |
}) | |
const updateValue = assign({ | |
value: (_, ev) => ev.value | |
}) | |
const isEnterOrTab = (_, ev) => ['Enter', 'Tab'].includes(ev.key) |
View machine.js
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
View machine.js
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
View machine.js
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
View RandomGiphy.jsx
This file contains 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
import { observer } from 'mobx-react-lite' | |
const RandomGiphy = observer(() => { | |
const settings = useSettings() | |
const giphy = useRandomGiphy(settings.tag) | |
return giphy ? <img src={giphy.url} /> : null | |
}) |
View SettingsProvider.jsx
This file contains 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
import React from 'react' | |
const context = React.createContext(mobx.observable({ | |
tag: 'kittens' | |
})) | |
export const SettingsProvider = ({ children }) => { | |
// we can employ some persistence here and load previous settings | |
// for now just return children because context already has state set | |
return children |
NewerOlder