Closed bgoosmanviz closed 1 year ago
Hi. Thanks for posting.
Would you care to share the implementation of your logger
plug-in?
import { Plugin } from "simpler-state";
export const logger = (name: string): Plugin => { return { set: (origSet, entity) => (...args) => { const prev = entity.get(); origSet(...args);
console.log(`${name}:`, prev, "-->", entity.get());
},
init: (origInit, entity) => () => {
origInit();
console.log(`[${name}] Initial value:`, entity.get());
},
}; };
On Dec 26, 2022 at 3:31:34 AM, Arnel Enero @.***> wrote:
Hi. Thanks for posting.
Would you care to share the implementation of your logger plug-in?
— Reply to this email directly, view it on GitHub https://github.com/arnelenero/simpler-state/issues/25#issuecomment-1364997206, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZ3BWOFQACS2PKRGI6T7X3WPFJWNANCNFSM6AAAAAATHAN47A . You are receiving this because you authored the thread.Message ID: @.***>
This code works as long as I pick a subset of values out of the object. The
extension
object is non-serializable, with functions in it, in addition to strings and numbers.