@espressif/rainmaker-base-cdf
    Preparing search index...

    Function extendObservable

    • Extends an object with additional observable properties.

      Parameters

      • target: any

        The object to be extended with observable properties.

      • properties: { [key: string]: any }

        The properties to be added to the object.

      Returns void

      The extended object with observable properties.

      class UserStore {
      

      user = { name: "John", age: 30 }; } const userStore = new UserStore(); extendObservable(userStore, { isAdmin: false }); console.log(userStore.isAdmin); // false

      This function extends an object with additional observable properties, allowing you to add reactive properties to an existing object. The target parameter specifies the object to be extended, while the properties parameter specifies the properties to be added. The properties will be made observable using Mobx, allowing you to reactively track changes to the object. This is useful for adding new properties to an existing object, or for converting a plain object into a reactive object. The function uses Mobx's extendObservable method internally to make the properties observable.