28 lines
833 B
TypeScript
28 lines
833 B
TypeScript
// The Lucia project.
|
|
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
|
// Authors:
|
|
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
|
|
// imacat.yang@dsp.im (imacat), 2023/9/23
|
|
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
|
/** @module myPiniaPlugin Custom Pinia plugin for store debugging. */
|
|
|
|
import { PiniaPluginContext } from 'pinia';
|
|
|
|
/**
|
|
* A Pinia plugin that logs all store mutations and state changes
|
|
* to the console for debugging purposes.
|
|
*
|
|
* @param {PiniaPluginContext} context - The Pinia plugin context.
|
|
*/
|
|
const myPiniaPlugin = (context: PiniaPluginContext) => {
|
|
const { store } = context;
|
|
|
|
// 在这里添加你的插件逻辑,例如:
|
|
store.$subscribe((mutation, state) => {
|
|
console.log(`Store mutation:`, mutation);
|
|
console.log(`New state:`, state);
|
|
});
|
|
};
|
|
|
|
export default myPiniaPlugin;
|