This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/src/common/browser-utils.ts
Liam 37e2b305ff
All checks were successful
Deploy SSR / deploy (push) Successful in 1m16s
cleanup and remove web worker tests
2024-09-13 20:04:04 +01:00

19 lines
389 B
TypeScript

/**
* Copies the given string to the clipboard
*
* @param str the string to copy
*/
export function copyToClipboard(str: string) {
navigator.clipboard.writeText(str);
}
/**
* Checks if the current context is a worker
*/
export function isRunningAsWorker() {
if (typeof window === "undefined") {
return false;
}
return navigator.constructor.name === "WorkerNavigator";
}