From: Eduardo San Martin Morote Date: Wed, 24 Mar 2021 16:00:08 +0000 (+0100) Subject: feat: add plugin api wip X-Git-Tag: v2.0.0-alpha.14~40 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=50bc807dce932c5cbe02612505535f05dfe6325a;p=thirdparty%2Fvuejs%2Fpinia.git feat: add plugin api wip --- diff --git a/docs/core-concepts/plugins.md b/docs/core-concepts/plugins.md new file mode 100644 index 00000000..fb1a413b --- /dev/null +++ b/docs/core-concepts/plugins.md @@ -0,0 +1,17 @@ +# Plugins + +Pinia stores can be fully extended thanks to a low level API. Here is a list of things you can do: + +- Add new properties to stores +- Add new methods to stores +- Wrap existing methods +- Change or even cancel actions +- Implement side effects like local storage +- Apply **only** to specific stores + +Plugins are added to pinia with `pinia.use()`: + +```js +// add a property named `secret` to every store that is created after this plugin is installed +pinia.use(() => ({ secret: '' })) +```