From 18c443c8b5e98038a2f5319ad9cd713dce355f49 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 21 Mar 2023 19:44:08 -0700 Subject: [PATCH] chore: cleanup --- packages/core/data/observable/index.ts | 31 ++++++++------------------ 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/packages/core/data/observable/index.ts b/packages/core/data/observable/index.ts index 5fd348d91..60e6c81da 100644 --- a/packages/core/data/observable/index.ts +++ b/packages/core/data/observable/index.ts @@ -108,10 +108,16 @@ export class Observable { private readonly _observers: { [eventName: string]: ListenerEntry[] } = {}; + /** + * Gets the value of the specified property. + */ public get(name: string): any { return this[name]; } + /** + * Updates the specified property with the provided value. + */ public set(name: string, value: any): void { // TODO: Parameter validation const oldValue = this[name]; @@ -124,6 +130,9 @@ export class Observable { this.notifyPropertyChange(name, newValue, oldValue); } + /** + * Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name. + */ public setProperty(name: string, value: any): void { const oldValue = this[name]; if (this[name] === value) { @@ -474,28 +483,6 @@ export class Observable { } } -export interface Observable { - /** - * Raised when a propertyChange occurs. - */ - on(event: 'propertyChange', callback: (data: EventData) => void, thisArg?: any): void; - - /** - * Updates the specified property with the provided value. - */ - set(name: string, value: any): void; - - /** - * Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name. - */ - setProperty(name: string, value: any): void; - - /** - * Gets the value of the specified property. - */ - get(name: string): any; -} - class ObservableFromObject extends Observable { public readonly _map: Record = {};