Created
October 17, 2016 09:51
-
-
Save davros85/2ed81a50fb738e1c2ce9696663e935f8 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'; | |
// ...other imports omitted... | |
import { EventBus } from './EventBus'; | |
let _instance: number = 0; | |
export default class CoffeeRoundWebPart extends BaseClientSideWebPart<any> { | |
private _id: number; | |
private eventBus = EventBus.getInstance(); | |
public constructor(context: IWebPartContext) { | |
super(context); | |
this._id = _instance++; | |
} | |
private initWorkaround():void{ | |
const tagName: string = `CoffeeRoundComponent-${this._id}`; | |
const componentElement: HTMLElement = this._createComponentElement(tagName); | |
this._registerComponent(tagName); | |
this.domElement.appendChild(componentElement); | |
var vm = new CoffeeRoundViewModel(); | |
ko.applyBindings(vm, this.domElement); | |
} | |
public render(): void { | |
console.log('render'); | |
if (!this.renderedOnce) | |
{ | |
this.initWorkaround(); | |
} | |
// push vals into eventbus with new values | |
this.eventBus.myProp(this.properties.myProp || ''); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment