You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/node_modules/overmind/src/proxyfyEffects.ts
+23-46Lines changed: 23 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -7,59 +7,36 @@ function isObject(value) {
7
7
lethasWarnedConstructor=false
8
8
letcurrentEffectId=0
9
9
10
-
functionwrapEffect(target,prop,path,cb){
11
-
constfunc=function(...args){
12
-
consteffectId=currentEffectId++
13
-
14
-
returncb({
15
-
func: target[prop].bind(target),
16
-
effectId,
17
-
name: path,
18
-
method: prop,
19
-
args,
20
-
})
21
-
}
22
-
23
-
returnnewProxy(func,{
24
-
construct(_,args){
10
+
exportfunctionproxifyEffects<Effects>(
11
+
effects: Effects,
12
+
cb: (effect)=>void,
13
+
path: string=''
14
+
): Effects{
15
+
returnnewProxy(effectsasany,{
16
+
apply(target,thisArg,agumentsList){
17
+
consteffectId=currentEffectId++
18
+
constname=path.split('.')
19
+
constmethod=name.pop()
20
+
returncb({
21
+
func: target.bind(thisArg),
22
+
effectId,
23
+
name: name.join('.'),
24
+
method,
25
+
args: agumentsList,
26
+
})
27
+
},
28
+
construct(Target,args){
25
29
if(!hasWarnedConstructor){
26
30
console.warn(
27
-
`EFFECTS - It is highly recommended to create a custom effect, exposing a method that deals with the instantiation of "${path}.${prop.toString()}". It improves readability and debugability of your app`
31
+
`EFFECTS - It is highly recommended to create a custom effect, exposing a method that deals with the instantiation of "${path}". It improves readability and debugability of your app`
0 commit comments