How to use the onetime.callCount function in onetime

To help you get started, we’ve selected a few onetime 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 sindresorhus / refined-github / source / features / ci-link.tsx View on Github external
async function init(): Promise {
	const icon = await fetchCIStatus();
	if (!icon) {
		return false;
	}

	if (onetime.callCount(fetchCIStatus) > 1) {
		icon.style.animation = 'none';
	}

	// Append to title (aware of forks and private repos)
	appendBefore('.pagehead h1', '.fork-flag', icon);
}
github sindresorhus / refined-github / source / features / ci-link.tsx View on Github external
async function init() {
	const icon = await fetchStatus();
	if (!icon) {
		return false;
	}

	if (callCount(fetchStatus) > 1) {
		icon.style.animation = 'none';
	}

	// Append to title (aware of forks and private repos)
	appendBefore('.pagehead h1', '.fork-flag', icon);
}

onetime

Ensure a function is only called once

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Popular onetime functions