Skip to content

Instantly share code, notes, and snippets.

@0x1000000
Created April 17, 2021 14:51
Show Gist options
  • Save 0x1000000/2feacaa9c92ab666072acf823809cd12 to your computer and use it in GitHub Desktop.
Save 0x1000000/2feacaa9c92ab666072acf823809cd12 to your computer and use it in GitHub Desktop.
@StateTracking({includeAllPredefinedFields:true})
export class GreetingService implements IGreetingServiceForm {
userName: string | null = null;
immediateUserName: string | null = null;
greeting: string = null;
isThinking: boolean = false;
countdown: number = 0;
@With("userName")
static onNameChanged(state: State): NewState{
...
}
@With("userName").Debounce(3000/*ms*/)
static greet(state: State): NewState
{
...
}
@With("immediateUserName")
static onImmediateUserName(state: State): NewState{
...
}
@With("countdown").Debounce(1000/*ms*/)
static countdownTick(state: State): NewState{
...
}
@With("isThinking")
static reset(state: State): NewState{
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment