Skip to content

Instantly share code, notes, and snippets.

@kdgerona
kdgerona / decorators-application.ts
Created April 25, 2023 02:30
Typescript decorators sample application
// import 'reflect-metadata'
type TCallback = (prev?: any) => void
type TSetStateParam = TCallback | any
type SetState = (param: TSetStateParam) => void
// Property Decorator
const UseState = function(initialValue: any) {
return function(target: any, key: string) {
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 21:25
Generated by XState Viz: https://xstate.js.org/viz
// Location Rate Templates - Counter (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
cancel: {
name: 'CANCEL',
display_name: 'Cancel',
icon: 'close',
display: true,
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 21:25
Generated by XState Viz: https://xstate.js.org/viz
// Location Summary - Counter (Machine)
const context = {
application_data: {
record: {}
},
params: {
id: ''
}
}
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 21:25
Generated by XState Viz: https://xstate.js.org/viz
// Edit Location - Counter (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
save: {
name: 'SAVE',
display_name: 'Save Changes',
icon: 'check',
display: true,
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 21:34
Generated by XState Viz: https://xstate.js.org/viz
// New Location - Counter (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
save_close: {
name: 'SAVE & CLOSE',
display_name: 'Save & Close',
icon: 'check',
display: true,
@kdgerona
kdgerona / machine.js
Created September 15, 2021 14:32
Generated by XState Viz: https://xstate.js.org/viz
// Edit Contact (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
save: {
name: 'SAVE',
display: true,
disabled: true
}
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 15:48
Generated by XState Viz: https://xstate.js.org/viz
// Contact Summary (Machine)
const context = {
application_data: {
record: {
id: '',
address: '',
company_name: '',
emails: [],
first_name: '',
title: '',
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 15:47
Generated by XState Viz: https://xstate.js.org/viz
// New Contact (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
save_close: {
name: 'SAVE & CLOSE',
display: true,
disabled: true,
},
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 15:19
Generated by XState Viz: https://xstate.js.org/viz
// Contact Summary (Machine)
const context = {
application_data: {
record: {
id: '',
address: '',
company_name: '',
emails: [],
first_name: '',
title: '',
@kdgerona
kdgerona / machine.js
Last active September 15, 2021 15:13
Generated by XState Viz: https://xstate.js.org/viz
// New Contact (Machine)
const context = {
application_config: {
max_attempts: 5,
buttons: {
save_close: {
name: 'SAVE & CLOSE',
display: true,
disabled: true,
},