baconjs / bacon.model Goto Github PK
View Code? Open in Web Editor NEWModel plugin for bacon.js
License: MIT License
Model plugin for bacon.js
License: MIT License
I get a huge memory leak if it try to bind many models at same time.
var a = new Bacon.Model(),
i = 0,
ITEMS_AMOUNT = 5000;
while (i++ < ITEMS_AMOUNT) {
var data = new Bacon.Model();
a.bind(data);
}
a.set('hello');
Here is the screenshot of the heap profiler in chrome
I've tried to fix the issue but it seems to come directly from Baconjs
While using an polyfilld array as value to combine throws exception. This is due to the for..in
loop which does not limit iteration within its own properties.
Will the fix 403e49d be pulled in to next release?
new Bacon.Model().set -> throw 'value called'
throws an exception. Nothing in the documentation suggests that Bacon.Model will call value
if it is a function.
I've noticed that the last commit was almost over 3 months ago, so I'm curious about your outlook on this project. Is there a reason that it hasn't been updated? Are you looking for help to maintain it?
Thanks!
Is there a way to unsubscribe all the model bindings?
I'd like to be able to set my own equals(a, b)
function on a Model
so that it can skip duplicates properly for simple value-like objects (e.g., time, coordinates).
This is probably simple enough to implement. I'd create a pull request, but I'm not experienced with Coffeescript, and I'm not sure what kind of API you would prefer.
I need to unsubscribe a model from a source added with model.apply
.
The unplug function returned by bus.plug
isn't returned (https://github.com/baconjs/bacon.model/blob/master/src/bacon.model.coffee#L47), so I can't see how to use the model without leaking memory.
This one has been bothering me for a few days now and I am not able to figure it out.
I have the following trivial Bacon/BaconModel code:
var t = new Bacon.Model(5);
t.slidingWindow(2,1).changes().onValue(value => {
if (value.length == 1)
console.log("t : "+value[0]);
else
console.log("t : "+value[1]+","+value[0]);
});
t.set(8);
t.set(2);
t.set(3);
What this seems to produce is the following stream:
t : 8,5
t : 2,8
t : 3,2
There is no initial value in this stream.
But as soon as I introduce a trivial flatMap into the mix, I start receiving the initial value which is NOT what I want. Please disregard what the sample flatMap does - it is simple yet valid I think for illustration purposes..
var t = new Bacon.Model(5);
t.flatMap(value => {return value}).slidingWindow(2,1).changes().onValue(value => {
if (value.length == 1)
console.log("t : "+value[0]);
else
console.log("t : "+value[1]+","+value[0]);
});
t.set(8);
t.set(2);
t.set(3);
The output stream becomes:
t : 5
t : 8,5
t : 2,8
t : 3,2
Please, could someone explain why is addition of flatMap causing the initial value t : 5 to be generated by this chain? Is this as designed or a bug ? If as designed, can you explain why it is generating the initial value output?
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.