mostjs / sample Goto Github PK
View Code? Open in Web Editor NEWA standalone implementation of sample and sampleArray for mostjs
License: MIT License
A standalone implementation of sample and sampleArray for mostjs
License: MIT License
The typescript definitions should have a fallback case for when the current scenarios can not be met.
sampleArray<A, C>(f: (...input: Array<any>) => C, streams: Array<Stream<any>>): Stream<C>
This is mostly for me to remember to do it :)
I ran into some troubles when using the standalone sample package. Basically both sample
versions have slightly different semantics when it comes to order of subscription. For the standalone sampler, the sampler is subscribed to first, then the source.
run (sink, scheduler) {
const sampleSink = new SampleSink(this.f, this.source, sink)
const samplerDisposable = this.sampler.run(sampleSink, scheduler)
const sourceDisposable = this.source.run(sampleSink.hold, scheduler)
return new SampleDisposable(samplerDisposable, sourceDisposable)
}
while in the other sample
it seems that the source is connected to first :
Sampler.prototype.run = function (sink, scheduler) {
var l = this.sources.length
var disposables = new Array(l + 1)
var sinks = new Array(l)
var sampleSink = new SampleSink(this.f, sinks, sink)
for (var hold, i = 0; i < l; ++i) {
hold = sinks[i] = new Hold(sampleSink)
disposables[i] = this.sources[i].run(hold, scheduler)
}
disposables[i] = this.sampler.run(sampleSink, scheduler)
return dispose.all(disposables)
}
That lead to unexpected behavior on a higher combinator that I am working on. I was able to work around this in two ways, either by directly modifying the standalone sample
code to reestablish the desired order, or by forcing the source to connect first, by using drain
. Both solutions are sub-optimal however (drain probably means I duplicate flows?, and direct modification of the source code means that a fresh npm install wont get the right version).
What do you recommend :
sample
operators?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.