How to use the mobservable.autorunUntil function in mobservable

To help you get started, we’ve selected a few mobservable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github staltz / flux-challenge / submissions / mweststrate / index.tsx View on Github external
.get(`http://localhost:3000/dark-jedis/${this.id}`)
			.end((err, res) => {
				if (err)
					throw "Eehh. Got error. Unspecified behavior.";
				const data = res.body;
				transaction(() => {
					this.name = data.name;
					this.homeworld = data.homeworld;
					this.master = data.master.id;
					this.apprentice = data.apprentice.id;
					this.isLoaded = true;
				});
				this.loadSiblings();
			});

		autorunUntil(
			() => !this.isVisible || this.store.hasSithOnCurrentPlanet,
			() => {
				this.fetcher.abort();
				if (this.isVisible && !this.isLoaded) {
					autorunUntil(() => !this.store.hasSithOnCurrentPlanet, () => {
						this.load();
					});
				}
			}
		);
	}