Comparing version 0.0.60 to 0.0.61
@@ -35,4 +35,5 @@ /* globals v */ | ||
// by default attain only redraws on route changes | ||
// so we can repidaly write to `tapePlayer` without worrying about perf. | ||
// so we can rapidly write to `tapePlayer` without worrying about perf. | ||
// near term, attain will do this automatically, so you can just write to | ||
// route/subroute's directly | ||
v.stream.dropRepeats( | ||
@@ -62,3 +63,3 @@ v.stream.interval(1000).map( () => tapePlayer() ) | ||
} | ||
console.log({ prev, next }) | ||
const decision = | ||
@@ -89,2 +90,10 @@ v.run( | ||
, ...scrubs | ||
, Playing({ time }){ | ||
console.log({ time, total: total(), x: time >= total() }) | ||
if( Number(time) >= total() ) { | ||
console.log('Restart') | ||
return v.Y(route.Playing({ time: 0 })) | ||
} | ||
return v.Y(next) | ||
} | ||
, Paused: () => v.N('You cannot pause if you are stopped') | ||
@@ -127,2 +136,3 @@ , Stopped: () => v.N('Already stopped') | ||
console.log(decision) | ||
return decision | ||
@@ -147,15 +157,23 @@ } | ||
, FF({ time, after }){ | ||
const shift = dt * 2 | ||
const shift = dt * 4 | ||
return ( | ||
time + dt > total() | ||
Number(time) > total() | ||
? route.Stopped({ time: total() }) | ||
: route.FF({ time: (Number(time) + shift).toFixed(1), after }) | ||
: route.FF({ | ||
time: (Number(time) + shift).toFixed(1) | ||
, after | ||
}) | ||
) | ||
} | ||
, RW({ time, after }){ | ||
const shift = dt * 2 | ||
const shift = dt * 4 | ||
return ( | ||
time - shift < 0 | ||
Number(time) - dt <= 0 | ||
? route.Stopped({ time: 0 }) | ||
: route.RW({ time: (Number(time) - shift).toFixed(1), after }) | ||
: route.RW({ | ||
time: | ||
Math.max(0, (Number(time) - shift)) | ||
.toFixed(1) | ||
, after | ||
}) | ||
) | ||
@@ -165,21 +183,21 @@ } | ||
) | ||
return decision | ||
} | ||
const validTransition = (b) => | ||
v.isY(transition(tapePlayer(),b)) | ||
const validTransition = (b) => true | ||
const transitions = stream() | ||
stream.scan( tapePlayer() ) ( | ||
(a,b) => { | ||
return v.run( | ||
transition(a,b) | ||
, v.getOr(a) | ||
) | ||
transitions.map( | ||
next => { | ||
const decision = | ||
transition(tapePlayer(), next) | ||
v.map( tapePlayer ) (decision) | ||
} | ||
) (transitions) | ||
) | ||
transitions.map(tapePlayer) | ||
let last = Date.now() | ||
@@ -191,7 +209,7 @@ function raf(){ | ||
if( dt > 100 ) { | ||
tapePlayer( | ||
const next = | ||
loop({ | ||
x: tapePlayer(), dt | ||
}) | ||
) | ||
tapePlayer(next) | ||
last = Date.now() | ||
@@ -206,2 +224,6 @@ } else { | ||
window.tapePlayer = tapePlayer | ||
window.transitions = transitions | ||
window.route = route | ||
const button = (src, attrs={}) => | ||
@@ -208,0 +230,0 @@ v( |
{ | ||
"name": "attain", | ||
"version": "0.0.60", | ||
"version": "0.0.61", | ||
"description": "A library for modelling and accessing data.", | ||
@@ -5,0 +5,0 @@ "main": "dist/attain.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
529888
4298