Skip to content

Instantly share code, notes, and snippets.

@davros85
Created October 17, 2016 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davros85/9dac900597aef9034ffdec3cf72af4fc to your computer and use it in GitHub Desktop.
Save davros85/9dac900597aef9034ffdec3cf72af4fc to your computer and use it in GitHub Desktop.
import * as ko from 'knockout';
// ...imports omitted...
import {EventBus} from './EventBus';
export default class CoffeeRoundViewModel {
// ...other vars omitted...
private eventBus = EventBus.getInstance();
constructor() {
var self = this;
self.eventBus.myProp.subscribe(
function(){
// this is called whenever the value changes
console.log('Subscribe: ' + self.eventBus.myProp());
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment