• Helper to trigger custom change notification.

    Type Parameters

    • M extends unknown

    Parameters

    • instance: M

      the instance which property.

    • name: Extract<keyof Properties<M>, PropertyKey>

      the name of the changed property.

    Returns void

    Example

     import {declare, notifyChange} from "apprt-core/Mutable";
    const globalCounter = 0;
    let Clazz = declare({
    counter: {
    get() {
    return globalCounter;
    }
    }
    });

    let instance = new Clazz();
    instance.watch("counter",({value})=>{
    console.log("count:"+value);
    })

    // ensure that external counter can be watched
    globalCounter++;
    notifyChange(instance,"counter");
    //-> count: 1

Generated using TypeDoc