From fc09730ffbbda2727f83534bdea2a793d3dd57d7 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:07:30 -0700 Subject: [PATCH] Tidy up DecorationService --- src/common/services/DecorationService.ts | 31 ++++++++---------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/common/services/DecorationService.ts b/src/common/services/DecorationService.ts index 693f8944..f18ad9b5 100644 --- a/src/common/services/DecorationService.ts +++ b/src/common/services/DecorationService.ts @@ -12,7 +12,6 @@ export class DecorationService extends Disposable implements IDecorationService public serviceBrand: any; private readonly _decorations: IInternalDecoration[] = []; - private _animationFrame: number | undefined; private _onDecorationRegistered = this.register(new EventEmitter()); public get onDecorationRegistered(): IEvent { return this._onDecorationRegistered.event; } @@ -49,33 +48,23 @@ export class DecorationService extends Disposable implements IDecorationService } this._decorations.length = 0; } - - private _queueRefresh(): void { - if (this._animationFrame !== undefined) { - return; - } - this._animationFrame = window.requestAnimationFrame(() => { - // this._refresh(); - this._animationFrame = undefined; - }); - } } -class Decoration implements IInternalDecoration { - public marker: IMarker; - public readonly onRenderEmitter = new EventEmitter(); - public readonly onRender = this.onRenderEmitter.event; - private _onDispose = new EventEmitter(); - public readonly onDispose = this._onDispose.event; +class Decoration extends Disposable implements IInternalDecoration { + public readonly marker: IMarker; public element: HTMLElement | undefined; public isDisposed: boolean = false; - public dispose(): void { - throw new Error('Method not implemented.'); - } + + public readonly onRenderEmitter = this.register(new EventEmitter()); + public readonly onRender = this.onRenderEmitter.event; + private _onDispose = this.register(new EventEmitter()); + public readonly onDispose = this._onDispose.event; + constructor( public readonly options: IDecorationOptions ) { + super(); this.marker = options.marker; - this.element = undefined; + // TODO: Make sure dispose doesn't need to do anything else? } }