How to use limit-concurrency-decorator - 1 common examples

To help you get started, we’ve selected a few limit-concurrency-decorator 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 imachug / zms / main / src / libs / hotreload.js View on Github external
import {zeroPage, zeroFS} from "../zero";
import limit from "limit-concurrency-decorator";

class HotReload {
	constructor() {
		zeroPage.on("setSiteInfo", this.onSetSiteInfo.bind(this));

		this.hotreloads = [];
		this.dbschema = null;
	}

	@limit(1)
	async getDbschema() {
		if(this.dbschema) {
			return this.dbschema;
		}

		this.dbschema = JSON.parse(await zeroFS.readFile("dbschema.json"));
		return this.dbschema;
	}


	register(tableName, f) {
		if(!this.hotreloads[tableName]) {
			this.hotreloads[tableName] = [];
		}
		this.hotreloads[tableName].push(f);
	}

limit-concurrency-decorator

Decorator to limit concurrency of async functions

ISC
Latest version published 11 months ago

Package Health Score

56 / 100
Full package analysis

Popular limit-concurrency-decorator functions