generated from garrettmills/template-npm-typescript
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
536 B
27 lines
536 B
|
|
export class SessionService {
|
|
private static instance?: SessionService
|
|
|
|
public static get(): SessionService {
|
|
if ( !this.instance ) {
|
|
this.instance = new SessionService()
|
|
}
|
|
|
|
return this.instance
|
|
}
|
|
|
|
protected data: {[key: string]: any} = {}
|
|
|
|
populate(data: {[key: string]: any}) {
|
|
this.data = data
|
|
}
|
|
|
|
get(key: string, fallback?: any): any {
|
|
return this.data[key] ?? fallback
|
|
}
|
|
|
|
set(key: string, value: any) {
|
|
this.data[key] = value
|
|
}
|
|
}
|