Skip to content

Commit 316cba4

Browse files
author
Matheus Marsiglio
committed
makes dispatch data fully cloned and improve subscribers
1 parent 5e78d24 commit 316cba4

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

dist/lawyer.js

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lawyer.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nucleojs",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"main": "dist/index.js",
55
"author": "Matheus Marsiglio <[email protected]>",
66
"repository": "git://github.com/mtmr0x/nucleo",

src/lawyer.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import NucleoObject from './nucleoTypes/NucleoObject';
22
import NucleoList from './nucleoTypes/NucleoList';
3+
import executeListeners from './executeListeners';
34

45
import { NucleoObjectType } from './_types/NucleoObjectType';
56
import indexSearch from './indexSearch';
67

7-
const executeListeners = (contractName: string, listeners: Array<Function>, data: any) => {
8-
for (let i = 0; i < listeners.length; i++) {
9-
listeners[i]({ contractName });
10-
}
11-
};
12-
138
const saveMethodReflection = (store: any, contractName: string, listeners: Array<Function>) => ({
149
dispatch: (data: any) => {
15-
executeListeners(contractName, listeners, data);
16-
return store[contractName] = data;
10+
return store[contractName] = indexSearch({
11+
contractName,
12+
storeData: data,
13+
data,
14+
listeners,
15+
newStoreData: {},
16+
newListenersData: {}
17+
});
1718
},
1819
update: (data: any) => {
1920
return store[contractName] = indexSearch({

0 commit comments

Comments
 (0)