tag:blogger.com,1999:blog-1799557918826925298.post3370443998697503067..comments2024-03-29T02:23:26.810-07:00Comments on null: Bacon.js Tutorial Part III : AJAX and StuffJuha Paananenhttp://www.blogger.com/profile/11863701709479259865noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-1799557918826925298.post-64104564865916515982020-07-16T10:25:36.561-07:002020-07-16T10:25:36.561-07:00sad shayari will validate your skills and<a href="https://shayaripro.in/sad-shayari-hindi-brocken-heart/" rel="nofollow">sad shayari</a> will validate your skills andAnonymoushttps://www.blogger.com/profile/01732866476441897958noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-53006435721859818662020-07-14T21:20:32.947-07:002020-07-14T21:20:32.947-07:00Now let’s take a closer look how to differentiate ...Now let’s take a closer look how to differentiate sin(3x+4y(x)) with respect to x: <a href="https://yourhomeguide.in/best-roti-maker/" rel="nofollow">best roti maker</a><br /><br />bestpressurecookerhttps://www.blogger.com/profile/14166626301680304478noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-56839099966462990552020-07-13T23:11:10.611-07:002020-07-13T23:11:10.611-07:00This blog has given me that thing which I never ex...This blog has given me that thing which I never expect to get from all over the websites.<br /><br /><a href="https://www.acte.in/digital-marketing-training-in-chennai" rel="nofollow"> Digital Marketing Training in Chennai | Certification | SEO Training Course</a> | <a href="https://www.acte.in/digital-marketing-training-in-bangalore" rel="nofollow"> Digital Marketing Training in Bangalore | Certification | SEO Training Course</a> | <a href="https://www.acte.in/digital-marketing-training-in-hyderabad" rel="nofollow"> Digital Marketing Training in Hyderabad | Certification | SEO Training Course</a> | <a href="https://www.acte.in/digital-marketing-training-in-coimbatore" rel="nofollow"> Digital Marketing Training in Coimbatore | Certification | SEO Training Course</a> | <a href="https://www.acte.in/digital-marketing-training" rel="nofollow">Digital Marketing Online Training | Certification | SEO Online Training Course</a> <br /><br /><br />Rashikahttps://www.blogger.com/profile/00063929624622023759noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-72827333390398678732020-05-13T04:16:05.441-07:002020-05-13T04:16:05.441-07:00I enjoyed your blog Thanks for sharing such an inf...I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.<br /><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing company in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing services in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing agency in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">best marketing services in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">SEO company in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">SEO services in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">social media marketing in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">social media company in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">PPC services in nagercoil</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing company in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing company in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing services in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">digital marketing agency in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">SEO company in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">SEO services in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">social media marketing in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">social media company in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">PPC services in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">online advertisement services in velachery</a><br /><a href="https://groarz.com/Digital-marketing" rel="nofollow">online advertisement services in nagercoil</a><br /><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web design company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web development company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website design company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website development company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web designing company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website designing company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">best web design company in nagercoil</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web design company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web development company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website design company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website development company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">web designing company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">website designing company in velachery</a><br /><a href="https://groarz.com/Web-Design" rel="nofollow">best web design company in velachery</a><br /><br />Thanks for Sharing - ( Groarz branding solutions )<br />The Marketerhttps://www.blogger.com/profile/05201326265579013641noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-4679777278096470272019-11-22T03:58:05.585-08:002019-11-22T03:58:05.585-08:00thanks for sharing such a wonderful information fr...thanks for sharing such a wonderful information from this post<br /><a href="https://onlineidealab.com/digital-marketing-courses-in-bangalore/" rel="nofollow">digital marketing</a><br />onlineidealabhttps://www.blogger.com/profile/16460838173178057044noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-53993958377873628762019-07-17T09:27:54.661-07:002019-07-17T09:27:54.661-07:00I love visiting the technical blogs designed only ...I love visiting the technical blogs designed only for certain professions. Only they understand what is going on. <a href="https://www.clipsit.net/www-risecredit-com-with-invitation-code/" rel="nofollow">Rise credit card account login</a>jerrysproductreviewshttps://www.blogger.com/profile/10505805977296110734noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-36294009624108523302017-07-12T02:23:33.759-07:002017-07-12T02:23:33.759-07:00Your blog has given me that thing which I never ex...Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!<br /><br /><a href="http://www.papdan.com" rel="nofollow">melbourne web developer</a><br />seravina danniellahttps://www.blogger.com/profile/17416651554211077082noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-85032177663919467762015-04-05T09:51:08.507-07:002015-04-05T09:51:08.507-07:00So the only difference between a stream and a prop...So the only difference between a stream and a property is that a property has an initial value?<br /><br />Also, any anti-patterns for making side-effects? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-41510468441521179962015-04-05T09:51:02.850-07:002015-04-05T09:51:02.850-07:00So the only difference between a stream and a prop...So the only difference between a stream and a property is that a property has an initial value?<br /><br />Also, any anti-patterns for making side-effects? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-43079961393864264562013-10-31T23:30:24.860-07:002013-10-31T23:30:24.860-07:00James, you're right! This is a simlified versi...James, you're right! This is a simlified version of a working solution. My approach to fixing this would be to disable the button when the availability check is pending. We can introduce a new Property like this:<br /><br /> checkPending = availabilityRequest.awaiting(availabilityResponse)<br /><br />And the take this into account in our enabling logic:<br /><br /> buttonEnabled = buttonEnabled.and(checkPending.not())<br /><br />Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-36126278370333284432013-10-31T20:47:37.521-07:002013-10-31T20:47:37.521-07:00Is it just me, or is there a bug in the code? It ...Is it just me, or is there a bug in the code? It seems to me that usernameAvailable is the availability of the username when the request was sent, not the currently entered username. It would be possible for the user to enter an available username, wait for the 'register' button to become enabled, then alter the username to an unavailable one and quickly click the register button!<br />I think it's necessary to check the equality of the requested username and the entered username before enabling the register button.Jameshttps://www.blogger.com/profile/07359784820141934758noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-87372563524552051252013-10-17T01:57:30.629-07:002013-10-17T01:57:30.629-07:00Thanks Juho! I fixed them diagrams.Thanks Juho! I fixed them diagrams.Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-85461463972789242572013-10-17T01:37:13.741-07:002013-10-17T01:37:13.741-07:00Hey, the diagrams are broken. Could you make the l...Hey, the diagrams are broken. Could you make the links point at https://github.com/baconjs/bacon.js/wiki/Diagrams ? Thanks.Juho Vepsäläinenhttps://www.blogger.com/profile/08481088432274153896noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-16909359279508123442013-02-19T22:54:17.224-08:002013-02-19T22:54:17.224-08:00Yeah. Using Bacon.js with Node.js eventStreams an...Yeah. Using Bacon.js with Node.js eventStreams and other Node.JS things.Elf Sternberghttps://www.blogger.com/profile/16692304291612435287noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-83597479943801477572013-01-26T14:01:04.073-08:002013-01-26T14:01:04.073-08:00LOL!
Oh, the TypeScript definition would be cool....LOL!<br /><br />Oh, the TypeScript definition would be cool. I'll have a look. Haven't done any TypeScript so far, but I'm a great fan of types, so it must be good:) The original Bacon (reactive-bacon) is a strongly typed (obviously) Haskell lib, you might want to have a look. (https://github.com/raimohanska/reactive-bacon). It's of course not identical to Bacon.js in design, but the basic concepts are the same, so that might help you with the typed version.<br /><br />Oh no, time to sleep. Happy hacking!Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-43965887871059222422013-01-26T13:46:45.961-08:002013-01-26T13:46:45.961-08:00OK, that makes sense - thanks for the explanation....OK, that makes sense - thanks for the explanation.<br /><br />> Ok, fix pushed to master.<br />That was quick!<br /><br />> it now seems that not everybody in the world is Finnish<br />I know - I myself was surprised to find out I wasn't Finnish :-)<br /><br />I've started knocking up a Typescript definition for bacon.js; could I send it over to you at some point to look through? The idea was to add it to this: https://github.com/borisyankov/DefinitelyTyped<br /><br />I'm also pretty busy currently (deadline soon - hence working on Sat evening), but it might also be a starting point for some documentation - I could at least create the JSDoc with the type info from the Typescript definition as a starting point.<br /><br />PS. Thanks for changing the blog settings!Nickhttps://www.blogger.com/profile/15024763194605299792noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-41380247825056381902013-01-26T12:32:30.216-08:002013-01-26T12:32:30.216-08:00Ok, fix pushed to master.
Finished in 10.619 seco...Ok, fix pushed to master.<br /><br />Finished in 10.619 seconds<br />182 tests, 1173 assertions, 0 failuresJuha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-16884730439252312962013-01-26T12:22:45.988-08:002013-01-26T12:22:45.988-08:00I don't have a full-solution based on flatMapL...I don't have a full-solution based on flatMapLatest for you, but I'll try to describe the general idea. <br /><br />So, you start with some Property that describes the state of your application. This property wil later be used for both switching the UI to different state and switching the result Property to receive input from the current UI DOM elements. Say<br /><br /> var state = $("#selectedBrand").asEventStream("change").toProperty()<br /><br />You want your UI as a whole to provide you with a Property called, say currentFormData, that contains the whole user input. The result from this Property should eventually contain the values from the latest DOM elements, of course. Let's try:<br /><br /> var currentFormData = state.flatMapLatest(function(newState) {<br /> var newUI = updateUI()<br /> return newUI.formData()<br /> }).toProperty()<br /><br />So now your UI will update each time the "state" property changes. The updateUI function does what ever DOM changes are required and returns a new Property that is composed of the event streams from the new DOM elements. The flatMapLatest thing will now switch between these Properties, cleaning up all the references to the old ones when you switch state.<br /><br />Does this make sense?<br /><br />Btw I actually discovered that flatMapLatest needs a little fix.. I'll ship it in soon.<br /><br />I'll definitely have to cover this in some form of documentation later. Unfortunately (?) I'm quite busy right now, so it may take some time. Contributions are always very welcome!Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-85619835234821423622013-01-26T12:06:04.871-08:002013-01-26T12:06:04.871-08:00Holy shit! You can't read Finnish?! Ok, I'...Holy shit! You can't read Finnish?! Ok, I'll have to change some blog settings immediately, as it now seems that not everybody in the world is Finnish :)Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-44170818904559686292013-01-26T12:01:48.192-08:002013-01-26T12:01:48.192-08:00I was the mysterious gentleman. I was reformulatin...I was the mysterious gentleman. I was reformulating my comment; Blogger doesn't seem to let you edit, but I only found that out after hitting the 'delete' button, because the buttons are in what to my untrained eye looks like Finnish(?), which I unfortunately can't read.<br /><br />Thanks for the responses. 1), 2a) and 2b) make sense (2b) is especially nice.) I haven't looked at flatMapLatest yet, but I don't really understand what it does. Am I understanding correctly that you are suggesting to a) create a new DOM event stream e.g. using $('.x').asEventStream('click'), b) create a 'changesEvent' stream from which I have a flatMap which references the latest DOM event stream, and c) have listeners listen to that?<br /><br />e.g. <br />var xStream = $('.x').asEventStream('click');<br />var changesStream = Bacon.once(1).flatMap(function() {<br /> return xStream;<br />});<br />changesStream.onValue(function(val) {<br /> $('.y').text(val);<br />});<br /><br />A few example/explanation of that would be nice if you are looking for further blog post topics (I did see the ajax one, but a few other scenarios might be nice.) Also, some examples of using properties and some of its specifics (e.g. sampledBy) would be nice.<br /><br />The scenario I was thinking of for 1) is:<br />a) the screen is drawn<br />b) a stream is created using Bacon.fromEventTarget<br />c) a listener is added to that stream listening continously for new events (e.g. a listener which validates input from a text field.)<br />d) the screen is redrawn.<br />e) the listener hasn't stopped listening for events, but the original element no longer exists.<br />f) however, the event handler isn't unbound from the element, because the listener is still listening for events.<br /><br />I've only been using the library since this morning but really enjoying it so far - thanks!Nickhttps://www.blogger.com/profile/15024763194605299792noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-78890839259561495472013-01-26T11:14:07.544-08:002013-01-26T11:14:07.544-08:00I guess I partly answered your questions already. ...I guess I partly answered your questions already. What do you think? <br /><br />Anyway, your actual observers (the onValue cases) don't need to worry about return values. It's usually better to use take(n), takeUntil or takeWhile to stop handling events after they are no longer desired. When an element is actually removed, well, would you have to remove your listeners if you were using jQuery or DOM events? If yes, you should use an appropriate end condition for your stream too. As you've seen, the Bacon.js interface to these sources is very simple. Please enlighten me if there's something I've missed!Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-82504605446464736872013-01-26T10:56:15.010-08:002013-01-26T10:56:15.010-08:00Something on lifecycle?
Covering the basics, lik...Something on lifecycle? <br /><br />Covering the basics, like how to end a stream either from the subscriber or the publisher or unsubscribing from a stream.<br /><br />Some web specifics would also be great, for instance:<br />- what happens when the DOM node the event was triggered from (using Bacon.fromEventTarget) was removed from the DOM? <br />- Does Bacon keep a hold of the reference to the node using fromEventSource, or is there a way to clear it? (looking at the source, it looks like it might leak, because the reference to the DOM element is held as long as no subscribers explicitly state they no longer want to receive events). If so what do we need to do to ensure the node gets GC-ed<br />- in the scenario where an area of the screen is redrawn; the DOM element which pushed events no longer exists, but another is now in its place. We don't want to lose the subscribers to the stream, so we want the original event source; but can something else be triggering the events? (I'm thinking that a function needs to be bound to the node event e.g. using jQuery.bind, which when the event is fired causes a callback which pushes the event to a bus perhaps?)Nickhttps://www.blogger.com/profile/15024763194605299792noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-3701742058008568392013-01-26T10:39:37.453-08:002013-01-26T10:39:37.453-08:00Oh, the zip function, right. Implementation would ...Oh, the zip function, right. Implementation would be somewhat similar to the merge implementation. Do you really need it? I decided to implement it the first time I actually need it. It's been a year or so, and still not a single actual use case :)Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-80821806937532612132013-01-26T10:36:46.769-08:002013-01-26T10:36:46.769-08:00For the mysterious gentleman who added a comment a...For the mysterious gentleman who added a comment and removed it:<br /><br />1) From the garbage collection viewpoint, having an EventStream on top of DOM events is similar to using jQuery events only, except that with an EventStream it's much easier to ensure that the event listener relationship is properly cleared. Just say element.asEventStream(...).take(1) for instance, to clear the listener after just one event. There's no central bookkeeping in Bacon.js, so your streams are eligible for GC when nobody has a reference to them. Also note that the Bacon.js jQuery-based streams are lazy; they add the listener to the jQuery source object only when they have listeners themselves, and clear this listener automatically when they're done.<br /><br />2) Assume you want to listen to events dynamically in the sense that you listen to events from element1 first and later switch to element2, while keeping the same listener listener listening to the same stream. Now you'll have at least three options.<br /><br />2A) Use a Bus (implements EventStream). Manually push events to the Bus from the sources you like.<br /><br />2B) Use jQuery live selectors. Assuming that all your dynamically added/removed elements are under element $(".form") and have the class "component", you can do $(".form").asEventStream("keyup", ".component") to get events from all those and let jQuery do the bookkeeping for you.<br /><br />2C) Use flatMapLatest. You might have a "changeEvents" stream from where you spawn new streams using flatMapLatest. The resulting stream will always include events from the latest spawned stream. Bacon.js will do the bookkeeping, adding/removing the listeners to/from the spawned streams.Juha Paananenhttps://www.blogger.com/profile/11863701709479259865noreply@blogger.comtag:blogger.com,1999:blog-1799557918826925298.post-91919921064729349932013-01-26T08:03:08.373-08:002013-01-26T08:03:08.373-08:00This comment has been removed by the author.Nickhttps://www.blogger.com/profile/15024763194605299792noreply@blogger.com