浏览代码

chore: hook docs

Ryan Chandler 3 年之前
父节点
当前提交
5c8630abef
共有 1 个文件被更改,包括 14 次插入0 次删除
  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.