reaper-osc
Version:
Controls Cockos Reaper using OSC
30 lines (29 loc) • 1.42 kB
TypeScript
/** Allows a subscriber to be notified of changes to the object's properties */
export interface INotifyPropertyChanged {
/**
* An event that can be subscribed to for property change notifications
* @param property The name of the property to subscribe to
* @param callback A callback to be called when the state of the specified property changes
* @returns A function that unsubscribes the event handler
*/
onPropertyChanged(property: string, callback: () => void): () => void;
}
/**
* Changes to the property will cause an event containing the name of the property to be fired by {@link INotifyPropertyChanged.onPropertyChanged}.
* Initializing the property will trigger the event.
*
* @remarks
* Requires {@link notifyOnPropertyChanged} decorator on the class
*
* @param overrideName Use to specify a different property name in the event. Useful for notifying changes to a get-only property from a change to a private backing file
*/
export declare function notify<T>(overrideName?: keyof T): (target: Object, propertyKey: string) => void;
/**
* Adds an implementation of {@link INotifyPropertyChanged.onPropertyChanged} to the class.
*
* @remarks
* Use in conjunction with {@link INotifyPropertyChanged} and decorating properties with {@link notify}
*/
export declare function notifyOnPropertyChanged<T extends {
new (...args: any[]): {};
}>(constructor: T): T;