1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-20 09:35:22 +02:00
bitwarden-browser/apps/browser/src/autofill/content/misc-utils.ts
renovate[bot] 28de9439be
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3

* prettier formatting updates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
2023-11-29 16:15:20 -05:00

24 lines
537 B
TypeScript

import { TabMessage } from "../../types/tab-messages";
async function copyText(text: string) {
await window.navigator.clipboard.writeText(text);
}
async function onMessageListener(
msg: TabMessage,
sender: chrome.runtime.MessageSender,
responseCallback: (response: unknown) => void,
) {
switch (msg.command) {
case "copyText":
await copyText(msg.text);
break;
case "clearClipboard":
await copyText("\u0000");
break;
default:
}
}
chrome.runtime.onMessage.addListener(onMessageListener);