Skip to content

Clipboard and sound

Text only. The clipboard can stall, so clipboard.text() and clipboard.setText(text) work off the caller’s thread and are async. text() gives an empty string if there’s no text. Add "clipboard": true to your permissions.

import { Wraith } from "wraith";
const clipboard = Wraith.clipboard();
await clipboard.setText(`0x${address.toString(16)}`);
const text = await clipboard.text();

WAV files and Windows’ own sounds. One plays at a time, so a new one stops the last, and nothing plays while the user has Sounds off in Wraith’s settings. These work from any thread.

  • sound.play(wav) takes a WAV file’s bytes, copied first.
  • sound.playSystem(sound) plays one of Windows’ own, a Sound.System: default, info, warning, error, question or notification.
  • sound.stop() stops whatever’s playing.
import { Wraith } from "wraith";
const sound = Wraith.sound();
sound.play(wavBytes); // an array of bytes
sound.playSystem("notification");
sound.stop();

Made with ♥ by Asgard