Skip to content

Commit b25bc5f

Browse files
committed
expose Xstream and FantasyX
1 parent 0654ced commit b25bc5f

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
docs = ./docs/**/*
1+
docsdir = ./docs/**/*
22
browserify = ./node_modules/.bin/browserify
33
watchify = ./node_modules/.bin/watchify
44
uglify = ./node_modules/.bin/uglifyjs
@@ -14,12 +14,12 @@ lib/%.js: src/%.ts
1414

1515
all: test browser
1616

17-
.PHONY: test build unit integrate browser
17+
.PHONY: test build unit integrate browser docs docs/publish
1818

1919
unit: build
2020
yarn test
2121

22-
integrate: test/*.js docs/src/main/tut/examples/example.js
22+
integrate: build test/*.js docs/src/main/tut/examples/example.js
2323
mocha test/test.js
2424

2525
docs/src/main/tut/examples/example.js: docs/src/main/tut/examples/example.tsx
@@ -39,10 +39,10 @@ dist/xreact-%.js: lib/xs/%.js
3939
dist/%.min.js: dist/%.js
4040
env NODE_ENV=production $(uglify) -c dead_code $(basename $(basename $@)).js -o $@
4141

42-
docs: $(docs)
43-
sbt makeMicrosite
42+
docs: $(docsdir)
43+
sbt "project docs" makeMicrosite
4444

45-
docs/publish: $(docs)
45+
docs/publish: $(docsdir)
4646
sbt "project docs" publishMicrosite
4747

4848
clean:

docs/src/main/tut/Get-Started.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ position: 1
2020
Sorry we don't have a **book** to document how to use xreact, and I don't really need to,
2121
there's only 3 things you should notice when using xreact, I'll explain by a simple counter app.
2222

23-
<iframe src="https://www.webpackbin.com/bins/-KsSVkmGpVrLlwylSrkE" frameborder="0" width="100%" height="500"></iframe>
23+
<p data-height="265" data-theme-id="0" data-slug-hash="gGqvBW" data-default-tab="js,result" data-user="jcouyang" data-embed-version="2" data-pen-title="XREACT" class="codepen">See the Pen <a href="https://codepen.io/jcouyang/pen/gGqvBW/">XREACT</a> by Jichao Ouyang (<a href="https://codepen.io/jcouyang">@jcouyang</a>) on <a href="https://codepen.io">CodePen</a>.</p>
24+
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
2425

2526
### 1. Define a simple stateless View component
2627

@@ -101,4 +102,6 @@ render(
101102

102103
If you are TypeScript user and want to enjoy a type safe counter app, it's simple to do so since xReact is written 100% in TypeScript.
103104

104-
<iframe src="https://www.webpackbin.com/bins/-KsSYQVTkFjd_MQon3b9" frameborder="0" width="100%" height="500"></iframe>
105+
<p data-height="265" data-theme-id="0" data-slug-hash="jGdzYR" data-default-tab="js,result" data-user="jcouyang" data-embed-version="2" data-pen-title="XREACT Counter in TypeScript" class="codepen">See the Pen <a href="https://codepen.io/jcouyang/pen/jGdzYR/">XREACT Counter in TypeScript</a> by Jichao Ouyang (<a href="https://codepen.io/jcouyang">@jcouyang</a>) on <a href="https://codepen.io">CodePen</a>.</p>
106+
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
107+

src/fantasy/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import './xstream'
2-
import './fantasyx'
1+
export { Xstream } from './xstream'
2+
export { FantasyX } from './fantasyx'
33
export * from './typeclasses/applicative'
44
export * from './typeclasses/functor'
55
export * from './typeclasses/apply'

src/xclass.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,10 @@ export function genXComponentClass<E extends Stream, I, S>(WrappedComponent: Rea
6161
console.log('UPDATE:', action)
6262
this.setState((prevState, props) => {
6363
let newState: S = action.call(this, prevState, props);
64-
let newStateWithoutPromise = <S>{}
65-
for (let i in newState) {
66-
let val = newState[i]
67-
if (isPromise(val)) {
68-
val.then((v: S) => this.setState(v))
69-
} else {
70-
newStateWithoutPromise[i] = newState[i]
71-
}
72-
}
73-
this.context[XREACT_ENGINE].history$.next(newStateWithoutPromise)
64+
this.context[XREACT_ENGINE].history$.next(newState)
7465
if (process.env.NODE_ENV == 'debug')
75-
console.log('STATE:', newStateWithoutPromise)
76-
return newStateWithoutPromise;
66+
console.log('STATE:', newState)
67+
return newState;
7768
});
7869
} else {
7970
/* istanbul ignore next */

0 commit comments

Comments
 (0)