Skip to content

Commit

Permalink
fix(): fix FBMLInstanceMethod decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Apr 1, 2017
1 parent 5b80d0b commit ae1f155
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/components/fb-video/fb-video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,23 @@ export class FBVideoComponent extends FBMLComponent implements OnInit {
@Output()
error: EventEmitter<any> = new EventEmitter<any>();

private _id: string;

constructor(
el: ElementRef,
rnd: Renderer
) {
super(el, rnd, 'fb-video');
this.nativeElement.id = this._id = 'video-' + String(Math.floor((Math.random() * 10000) + 1));
}

/**
* @hidden
*/
ngOnInit() {
FB.Event.subscribe('xfbml.ready', (msg: any) => {
if (msg.type === 'video') {
if (msg.type === 'video' && msg.id === this._id) {
this._instance = msg.instance;
console.log(msg);
// TODO make sure that we getting the right instance, in case we have more than one player

this._instance.subscribe('startedPlaying', (e: any) => this.startedPlaying.emit(e));
this._instance.subscribe('paused', (e: any) => this.paused.emit(e));
this._instance.subscribe('finishedPlaying', (e: any) => this.finishedPlaying.emit(e));
Expand Down
2 changes: 1 addition & 1 deletion src/components/fbml-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function FBMLInstanceMethod(target: any, key: string) {
enumerable: true,
value: function(...args: any[]) {
if (this._instance) {
return this._instance[key].apply(this, args);
return this._instance[key].apply(this._instance, args);
} else {
console.warn('ng2-facebook-sdk: tried calling instance method before component is ready.');
return null;
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
"declaration": true,
"outDir": "dist/esm",
"lib": [
"es6",
"es2015",
"dom"
],
"newLine": "LF"
},
"exclude": [
"node_modules",
"dist",
"src/**/*.spec.ts"
"dist"
],
"angularCompilerOptions": {
"genDir": "aot"
Expand Down

0 comments on commit ae1f155

Please sign in to comment.