Create readonly
method
#162
Replies: 3 comments 5 replies
-
Implicit: https://share.effector.dev/TBtJRKG3 By @yumauri |
Beta Was this translation helpful? Give feedback.
-
Lyrical digression: Following my example snippets, one thought came to my mind: For now, effector’s graph hasn’t any information about edges. All effector’s graph’s edges are just JavaScript references. What if! We could add some meta-data to edges? Like color. And inside node’s pipe we could get meta-data of the edge, by which one we’ve got data to process? Let’s say, by default, all edges has no color. We add one edge, paint it in black, and we can filter data — allow only data, which came by this black edge. All API, used after on the node, will add colorless edges (by default) — and we will just ignore data from those new edges. Same idea, as in my snippets, but embedded inside effector’s core. Maybe this edges’ meta-data could be used elsewhere, to solve other cases. |
Beta Was this translation helpful? Give feedback.
-
Looks like, since the deprecation of UPD: |
Beta Was this translation helpful? Give feedback.
-
Abstract
In some cases, I should forbid store modification by external modules.
For example, when I write
userService
, I want to encapsulate all modification in this service and provide something likereadonly
store for the rest of the application.Example:
So, here I want to forbid
.on
calls onuserService.$userName
and usageuserService.$userName
as a target in any operators.Motivation
Encapsulation of write operations is a good way to structure any program. So, I think, we need a way to forbid writes to stores in some cases.
Beta Was this translation helpful? Give feedback.
All reactions