purescript-web/purescript-web-clipboard

Example Projects using this Library

Opened this issue · 1 comments

Hi,

What are some Example Projects currently using this Library?

let me know where/if I should ask questions like this about this project in the future.

garyb commented

I don't think there is anything out there right now, I only recently added types and functions to this library to make it semi usable! (Previously it just had the clipboard event definition).

My one and only usage of it is essentially:

import Prelude

import Effect (Effect)
import Web.Clipboard as Clipboard
import Web.HTML as HTML
import Web.HTML.Window as Window

copy  String  Effect Unit
copy text =
  void $ Clipboard.writeText text
    =<< Clipboard.clipboard
    =<< Window.navigator
    =<< HTML.window

Reading from the clipboard would be a little more involved, but if you get totally stuck I can try and help figure it out. It would be good to have an example of both operations in the README, so it would help other people too.