]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat: add plugin api wip
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 24 Mar 2021 16:00:08 +0000 (17:00 +0100)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 28 Apr 2021 17:45:38 +0000 (19:45 +0200)
docs/core-concepts/plugins.md [new file with mode: 0644]

diff --git a/docs/core-concepts/plugins.md b/docs/core-concepts/plugins.md
new file mode 100644 (file)
index 0000000..fb1a413
--- /dev/null
@@ -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: '' }))
+```