From 6a06596a00759822248110239789f2b0c5d02c69 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sat, 4 Feb 2017 22:29:49 +0530 Subject: [PATCH] perf(fromDOM): use bind operator instead of closure --- src/sources/FromDOM.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sources/FromDOM.ts b/src/sources/FromDOM.ts index a5d61cc..ff6ea5f 100644 --- a/src/sources/FromDOM.ts +++ b/src/sources/FromDOM.ts @@ -3,7 +3,6 @@ */ import {Observable} from '../types/core/Observable' import {Observer} from '../types/core/Observer' -import {Scheduler} from '../types/Scheduler' import {Subscription} from '../types/core/Subscription' import {IListener} from '../types/IListener' import {Curry} from '../lib/Curry' @@ -25,8 +24,8 @@ class DOMObservable implements TResult { constructor (private name: string, private element: HTMLElement) { } - subscribe (observer: Observer, scheduler: Scheduler): Subscription { - const listener = (e: Event) => observer.next(e) + subscribe (observer: Observer): Subscription { + const listener = observer.next.bind(observer) this.element.addEventListener(this.name, listener) return new DOMSubscription(this.element, listener, this.name) }