Browse Source

chore: hook docs

Ryan Chandler 3 years ago
parent
commit
5c8630abef
1 changed files with 14 additions and 0 deletions
  1. 14 0
      README.md

+ 14 - 0
README.md

@@ -67,6 +67,20 @@ Since you can pass any properties through to the `$clipboard` function, if you p
 
 The clipboard will now contain `["foo","bar"]`.
 
+### Hooks
+
+If you are using the `npm` installation method for this package or the ESM distribution, you can use the `Clipboard.configure()` method to attach an `onCopy` hook to the clipboard.
+
+```js
+import Clipboard from '@ryangjchandler/alpine-clipboard'
+
+Alpine.plugin(Clipboard.configure({
+    onCopy: () => {
+        console.log('Copied!')
+    }
+}))
+```
+
 ## Versioning
 
 This projects follow the [Semantic Versioning](https://semver.org/) guidelines.