3 ms·
The VueUse library is a really good place for these since it's all composables like `useClipboard`. Here's an example of a Vue composable for the clipboard: ht
by CharlieDigital 2y ago
The VueUse library is a really good place for these since it's all composables like `useClipboard`.
Here's an example of a Vue composable for the clipboard: https://github.com/vueuse/vueuse/blob/main/packages/core/useClipboard/index.ts https://github.com/vueuse/vueuse/blob/main/packages/core/use...
Here is an example of how it's used: https://github.com/vueuse/vueuse/blob/main/packages/core/useClipboard/index.md https://github.com/vueuse/vueuse/blob/main/packages/core/use...
And the unit tests: https://github.com/vueuse/vueuse/blob/main/packages/core/useClipboard/index.browser.test.ts https://github.com/vueuse/vueuse/blob/main/packages/core/use...
Another one from the same lib: https://github.com/vueuse/vueuse/blob/main/packages/core/useColorMode/index.ts https://github.com/vueuse/vueuse/blob/main/packages/core/use...
Unit test: https://github.com/vueuse/vueuse/blob/main/packages/core/useColorMode/index.test.ts https://github.com/vueuse/vueuse/blob/main/packages/core/use...
I'm pretty certain that Svelte took inspiration from Vue composables and I'd also guess that the community will have a bit of friction before people start to get its use cases (same as it was with Vue when it was introduced).