1function updateClipboard(newClip) {
2 navigator.clipboard.writeText(newClip).then(function() {
3 /* clipboard successfully set */
4 }, function() {
5 /* clipboard write failed */
6 });
7}
8
1navigator.permissions.query({name: "clipboard-write"}).then(result => {
2 if (result.state == "granted" || result.state == "prompt") {
3 /* write to the clipboard now */
4 }
5});
6