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

19 lines
389 B
TypeScript
Raw Normal View History

2024-09-11 22:10:16 +00:00
/**
* Copies the given string to the clipboard
*
* @param str the string to copy
*/
export function copyToClipboard(str: string) {
navigator.clipboard.writeText(str);
}
2024-09-13 19:04:04 +00:00
/**
* Checks if the current context is a worker
*/
export function isRunningAsWorker() {
if (typeof window === "undefined") {
return false;
}
return navigator.constructor.name === "WorkerNavigator";
}