Last active
December 19, 2019 14:39
-
-
Save testshallpass/6c6c867269348c485a1e0d6ae3f55e90 to your computer and use it in GitHub Desktop.
DropdownHolder Example #2
This file contains hidden or 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
type AlertType = 'info' | 'warn' | 'error' | 'success' | |
export type DropdownType = { | |
alertWithType: (type: AlertType, title: string, message: string) => void | |
} | |
export class DropDownHolder { | |
static dropDown: DropdownType | |
static setDropDown(dropDown: DropdownType) { | |
this.dropDown = dropDown | |
} | |
static alert(type: AlertType, title: string, message: string) { | |
this.dropDown.alertWithType(type, title, message) | |
} | |
} | |
// ... | |
// then call | |
DropDownHolder.alert('error', 'Title', 'error message') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment