Skip to content

Commit 726e32c

Browse files
committed
commit
1 parent 80790bd commit 726e32c

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "timeengine",
3-
"version": "6.5.0",
3+
"version": "6.5.1",
44
"description": "TimeEngine is a tiny, simple yet versatile library that provides first class reactive value 'over time' with smart dependency resolving capability in JavaScript. Built for a programming paradigm: Dependency driven Functional Reactive Programming (DFRP)",
55
"main": "timeengine.js",
66
"scripts": {

react-test/index.jsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
// on TimeEngine infinite Sequence
2727
// map natural numbers sequence on intervalSeq(1000)
2828
const TimerElement = () => __Element(__
29-
.intervalSeq(Immutable.Range(), 1000)
30-
.__((count) => (__.log.t = count)) //console.log
31-
.__((count) => (<div>{"Timer : "}{count}</div>)));
29+
.intervalSeq(Immutable.Range(), 1000)
30+
.__((count) => (__.log.t = count)) //console.log
31+
.__((count) => (<div>{"Timer : "}{count}</div>)));
3232

3333
// memory leak, performance issue
3434
//how about games? memoized_reduce is needed
@@ -37,7 +37,7 @@
3737
const __updn = __(true); //1 or -1 or initially 0
3838
const __seqEl = __([__updn])
3939
.__(([updn]) => (__updn
40-
.reduce((a, b) => (a + b)))) //js Array.reduce
40+
.reduce((a, b) => (a + b)))) //js Array.reduce
4141
.__((count) => (<span>{count}</span>));
4242
const init = () => (__updn.t = 0); //just trigger to view the init
4343
const __runNow = __
@@ -48,7 +48,7 @@
4848
onClick={() => (__updn.t = 1)}>{"Up"}</button>
4949
<button
5050
onClick={() => (__updn.t = -1)}>{"Down"}</button>
51-
&nbsp;&nbsp;{__Element(__seqEl)}&nbsp;&nbsp;
51+
  {__Element(__seqEl)}  
5252
</span>);
5353
};
5454

@@ -84,7 +84,7 @@
8484
onClick={() => (__updn.t = 1)}>{"Up"}</button>
8585
<button
8686
onClick={() => (__updn.t = -1)}>{"Down"}</button>
87-
&nbsp;&nbsp;{__Element(__seqEl)}&nbsp;&nbsp;
87+
  {__Element(__seqEl)}  
8888
<button
8989
onClick={init}>{"Reset"}</button>
9090
</div>);
@@ -99,16 +99,15 @@
9999
const THETA = DEG / 180 * Math.PI; //radian
100100
const G = 9.8; //gravity const
101101
//t seconds elapsed 0msec time resolution
102-
const t = __
103-
.intervalSeq(Immutable.Range(), 10)
104-
.__((count) => (count * 10 / 1000));
102+
const t = __([__.intervalSeq(Immutable.Range(), 10)])
103+
.__(([count]) => (count * 10 / 1000));
105104
const x = __([t]).__(([t]) => V0 * Math.cos(THETA) * t);
106-
const y = __([t]).__(([t]) => V0 * Math.sin(THETA) * t - 1 / 2 * G * Math.pow(t, 2));
105+
const y = __([t]).__(([t]) => V0 * Math.sin(THETA) * t - 1 / 2 * G * Math.pow(t, 2)).log();
107106
//==================================
108107
const Drawscale = 1; //1 dot = 1 meter
109108
const __seqEl = __([x, y]) //atomic update
110109
.__(([x, y]) => (
111-
<div>
110+
<div>
112111
<svg height = "250" width = "100%">
113112
<circle r="2" fill="red"
114113
cx = {50 + x * Drawscale} cy = {250 - y * Drawscale}/>

0 commit comments

Comments
 (0)