@@ -487,7 +487,22 @@ trait WindowTimers extends js.Object {
487
487
@ JSGlobal
488
488
class Navigator
489
489
extends NavigatorID with NavigatorOnLine with NavigatorContentUtils
490
- with NavigatorGeolocation with NavigatorStorageUtils with NavigatorLanguage
490
+ with NavigatorGeolocation with NavigatorStorageUtils
491
+ with NavigatorLanguage {
492
+
493
+ /**
494
+ * The Clipboard API adds to the Navigator interface the read-only
495
+ * clipboard property, which returns the Clipboard object used to read
496
+ * and write the clipboard's contents. The Clipboard API can be used
497
+ * to implement cut, copy, and paste features within a web application.
498
+ *
499
+ * Use of the asynchronous clipboard read and write methods requires
500
+ * that the user grant the web site or app permission to access the
501
+ * clipboard. This permission must be obtained from the Permissions API
502
+ * using the "clipboard-read" and/or "clipboard-write" permissions.
503
+ */
504
+ def clipboard : Clipboard = js.native
505
+ }
491
506
492
507
@ js.native
493
508
trait NodeSelector extends js.Object {
@@ -7958,3 +7973,50 @@ object VisibilityState {
7958
7973
*/
7959
7974
val unloaded = " unloaded" .asInstanceOf [VisibilityState ]
7960
7975
}
7976
+
7977
+ /**
7978
+ * The Clipboard interface implements the Clipboard API, providing—if the user grants
7979
+ * permission—both read and write access to the contents of the system clipboard.
7980
+ * The Clipboard API can be used to implement cut, copy, and paste features within
7981
+ * a web application.
7982
+ *
7983
+ * The system clipboard is exposed through the global Navigator.clipboard property
7984
+ *
7985
+ * Clipboard is based on the EventTarget interface, and includes its methods.
7986
+ *
7987
+ * MDN
7988
+ */
7989
+ @ js.native
7990
+ trait Clipboard extends EventTarget {
7991
+
7992
+ /**
7993
+ * The read() method of the Clipboard interface requests a copy of the clipboard's
7994
+ * contents, delivering the data to the returned Promise when the promise is
7995
+ * resolved. Unlike readText(), the read() method can return arbitrary data,
7996
+ * such as images.
7997
+ *
7998
+ * To read from the clipboard, you must first have the "clipboard-read" permission.
7999
+ */
8000
+ def read (): js.Promise [DataTransfer ] = js.native
8001
+
8002
+ /**
8003
+ * The readText() method returns a Promise which resolves with a copy of the
8004
+ * textual contents of the system clipboard.
8005
+ */
8006
+ def readText (): js.Promise [String ] = js.native
8007
+
8008
+ /**
8009
+ * The write() method writes arbitrary data, such as images, to the clipboard.
8010
+ * This can be used to implement cut and copy functionality.
8011
+ *
8012
+ * Before you can write to the clipboard, you need to use the Permissions API
8013
+ * to get the "clipboard-write" permission.
8014
+ */
8015
+ def write (data : DataTransfer ): js.Promise [Unit ] = js.native
8016
+
8017
+ /**
8018
+ * The writeText() method writes the specified text string to the system
8019
+ * clipboard.
8020
+ */
8021
+ def writeText (newClipText : String ): js.Promise [Unit ] = js.native
8022
+ }
0 commit comments