Skip to content

Commit 74ad38e

Browse files
committed
init
0 parents  commit 74ad38e

File tree

49,321 files changed

+2817961
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49,321 files changed

+2817961
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/*
2+
.history/*

demo-1/.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"stage-2"
5+
],
6+
"plugins": []
7+
}

demo-1/README.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 简单的状态管理器
2+
```
3+
npm i
4+
npm start
5+
```

demo-1/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { createStore } from './redux';
2+
3+
let initState = {
4+
counter: {
5+
count: 0
6+
},
7+
info: {
8+
name: '',
9+
description: ''
10+
}
11+
}
12+
13+
let store = createStore(initState);
14+
15+
store.subscribe(() => {
16+
let state = store.getState();
17+
console.log(`${state.info.name}${state.info.description}`);
18+
});
19+
store.subscribe(() => {
20+
let state = store.getState();
21+
console.log(state.counter.count);
22+
});
23+
24+
store.changeState({
25+
...store.getState(),
26+
info: {
27+
name: '前端九部',
28+
description: '我们都是前端爱好者!'
29+
}
30+
});
31+
32+
store.changeState({
33+
...store.getState(),
34+
counter: {
35+
count: 1
36+
}
37+
});

demo-1/node_modules/.bin/babel

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

demo-1/node_modules/.bin/babel-doctor

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

demo-1/node_modules/.bin/babel-external-helpers

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

demo-1/node_modules/.bin/babel-node

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

0 commit comments

Comments
 (0)