@@ -488,6 +488,7 @@ trait WindowTimers extends js.Object {
488
488
class Navigator
489
489
extends NavigatorID with NavigatorOnLine with NavigatorContentUtils
490
490
with NavigatorGeolocation with NavigatorStorageUtils with NavigatorLanguage
491
+ with NavigatorClipboard
491
492
492
493
@ js.native
493
494
trait NodeSelector extends js.Object {
@@ -7958,3 +7959,76 @@ object VisibilityState {
7958
7959
*/
7959
7960
val unloaded = " unloaded" .asInstanceOf [VisibilityState ]
7960
7961
}
7962
+
7963
+ /**
7964
+ * The NavigatorClipboard interface contains a constructor method allowing
7965
+ * objects implementing it to obtain a Clipboard instance.
7966
+ *
7967
+ * There is no object of type NavigatorClipboard, but some, like Navigator
7968
+ * implements it.
7969
+ *
7970
+ * MDN
7971
+ */
7972
+ @ js.native
7973
+ trait NavigatorClipboard extends js.Object {
7974
+
7975
+ /**
7976
+ * The Clipboard API adds to the Navigator interface the read-only
7977
+ * clipboard property, which returns the Clipboard object used to read
7978
+ * and write the clipboard's contents. The Clipboard API can be used
7979
+ * to implement cut, copy, and paste features within a web application.
7980
+ *
7981
+ * Use of the asynchronous clipboard read and write methods requires
7982
+ * that the user grant the web site or app permission to access the
7983
+ * clipboard. This permission must be obtained from the Permissions API
7984
+ * using the "clipboard-read" and/or "clipboard-write" permissions.
7985
+ */
7986
+ def clipboard : Clipboard = js.native
7987
+ }
7988
+
7989
+ /**
7990
+ * The Clipboard interface implements the Clipboard API, providing—if the user grants
7991
+ * permission—both read and write access to the contents of the system clipboard.
7992
+ * The Clipboard API can be used to implement cut, copy, and paste features within
7993
+ * a web application.
7994
+ *
7995
+ * The system clipboard is exposed through the global Navigator.clipboard property
7996
+ *
7997
+ * Clipboard is based on the EventTarget interface, and includes its methods.
7998
+ *
7999
+ * MDN
8000
+ */
8001
+ @ js.native
8002
+ trait Clipboard extends EventTarget {
8003
+
8004
+ /**
8005
+ * The read() method of the Clipboard interface requests a copy of the clipboard's
8006
+ * contents, delivering the data to the returned Promise when the promise is
8007
+ * resolved. Unlike readText(), the read() method can return arbitrary data,
8008
+ * such as images.
8009
+ *
8010
+ * To read from the clipboard, you must first have the "clipboard-read" permission.
8011
+ */
8012
+ def read (): js.Promise [DataTransfer ] = js.native
8013
+
8014
+ /**
8015
+ * The readText() method returns a Promise which resolves with a copy of the
8016
+ * textual contents of the system clipboard.
8017
+ */
8018
+ def readText (): js.Promise [String ] = js.native
8019
+
8020
+ /**
8021
+ * The write() method writes arbitrary data, such as images, to the clipboard.
8022
+ * This can be used to implement cut and copy functionality.
8023
+ *
8024
+ * Before you can write to the clipboard, you need to use the Permissions API
8025
+ * to get the "clipboard-write" permission.
8026
+ */
8027
+ def write (data : DataTransfer ): js.Promise [Unit ] = js.native
8028
+
8029
+ /**
8030
+ * The writeText() method writes the specified text string to the system
8031
+ * clipboard.
8032
+ */
8033
+ def writeText (newClipText : String ): js.Promise [Unit ] = js.native
8034
+ }
0 commit comments