Module Js_of_ocaml.Clipboard

Clipboard API.

A code example:

  if Clipboard.is_supported ()
  then
    ignore
      (Promise.map
         (fun () -> Console.console##log (Js.string "copied"))
         ((Clipboard.clipboard ())##writeText (Js.string "Hello!")))
class type clipboardItem = object ... end
val clipboardItem : (Js.Unsafe.any -> clipboardItem Js.t) Js.constr

new%js clipboardItem data builds a clipboard item. data is a plain JavaScript object whose keys are MIME types and whose values are the associated File.blob, string, or a promise resolving to either.

val item_supports : Js.js_string Js.t -> bool Js.t

item_supports mime reports whether the given MIME type is supported by the clipboard. Bound to the static ClipboardItem.supports method.

class type clipboard = object ... end
val clipboard : unit -> clipboard Js.t

The navigator.clipboard object.

val is_supported : unit -> bool

Whether navigator.clipboard is available in the current environment.