Last active
October 17, 2016 11:12
-
-
Save davros85/33b0558c20bba93afe5cf8b17e3a2269 to your computer and use it in GitHub Desktop.
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 * as ko from 'knockout'; | |
export class EventBus { | |
private static _instance:EventBus = new EventBus(); | |
// props for pub-sub | |
public myProp:KnockoutObservable<string> = ko.observable(''); | |
constructor(){ | |
if(EventBus._instance){ | |
throw new Error('Cannot instantiate. Use EventBus.getInstance() instead'); | |
} | |
EventBus._instance = this; | |
} | |
public static getInstance():EventBus{ | |
return EventBus._instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment