From: Eduardo San Martin Morote Date: Thu, 15 Apr 2021 14:43:14 +0000 (+0200) Subject: feat(plugins): pass a context object to plugins instead of app X-Git-Tag: v2.0.0-alpha.14~53 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=bcb4ec3422635dd57f655e58f72a9a7a1c7dba0d;p=thirdparty%2Fvuejs%2Fpinia.git feat(plugins): pass a context object to plugins instead of app BREAKING CHANGE: To improve the plugin api capabilities, `pinia.use()` now receives a context object instead of just `app`: ```js // replace pinia.use((app) => {}) // with pinia.use(({ app }) => {}) ``` --- diff --git a/docs/core-concepts/plugins.md b/docs/core-concepts/plugins.md deleted file mode 100644 index fb1a413b..00000000 --- a/docs/core-concepts/plugins.md +++ /dev/null @@ -1,17 +0,0 @@ -# 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: '' })) -```