mobx#extendObservable JavaScript Examples
The following examples show how to use
mobx#extendObservable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudStore.js From lens-extension-cc with MIT License | 6 votes |
/**
* Adds a Cloud to this store, notifying listeners bound to the `clouds` observable.
* @param {Cloud} cloud
* @throws {Error} If the cloud already exists in this store (based on URL).
*/
addCloud(cloud) {
const { cloudUrl } = cloud;
if (this.clouds[cloudUrl]) {
logger.error(
'CloudStore.addCloud()',
`Ignoring: Store already has an entry for url=${logValue(
cloudUrl
)}; existing=${this.clouds[cloudUrl]}, new=${cloud}`
);
return;
}
this.listenForChanges(cloud);
extendObservable(this.clouds, { [cloudUrl]: cloud });
}