God that’s ugly, who writes.

 
Sizelove: Actually, what do you mean by every click?

Masella: Because when a promise is filled, you call all of its callbacks. once. any new callbacks that get registered on a promise are called _immediately_

Masella: That’s how they’re able to work for both synchronous and asynchronous tasks

Masella: I mean that every single time obj is clicked, i want my callback to be called. you know, like addEventListener

Rickerson: And a promise gets “resolved”

Masella: A callback is a generic term for a function you p*** into a function

Somera: You can have something else that works similarly without state.

Worden: Particularly, something that I think Dolby has called “Tasks”.

Gilchrest: Or maybe it’s someone else, dunno.

Waneka: I gotta find some use cases, specifically with named callbacks

Parrales: Meh, apparently other things called Tasks now too.

Wenner: Afroradiohead: you can name a callback but it would only be accessible. ok someone correct me, becasue i swear it wouldn’t be accessible anywhere

Saxbury: Basically, monadic callback receivers.

Vandeberg: Heh why wouldn’t it be accessible?

Masella: You can attach a name to a function and still have it be. unreferenced

Cherchio: Afroradiohead: but a callback doesn’t have to be an anonymous function, if you want to bind a bunch of different dom elements to one behavior, you can have a name function and p*** a named function into an event listener as its callback

Masella: Obj.addEventListener ‘click’, function handleObjClick { . } ; – named, not referenced outside addEventListener

Blasetti: But Masella it isn’t even referenced by that name within event listener. it’s p***ed in under something else which could be anonymous or not

Masella: Var foo = function { . }; – anonymous and referenced, so i can do obj.addEventListener ‘click’, foo ;

Hoffarth: Function Actionfn{ return { run: fn, bind: functionbfn{ return Actionfunctioncb{ fnfunctiona{ bfna.runcb; }; }; } }; }

Masella: Games: it doesn’t matter what the reference inside is called. you cannot get to it. it’s worthless

Fahrenbruck: Function unita{ return Actionfunctioncb{ cba; }; }

Molitoris: So. promises make async calls more readable. do you know why that’s so Masella?

Masella: Games: the difference is the name or lack thereof will show up in the stack trace. for example, when the function throws an exception

Kuwada: Afroradiohead: because if you want to do one callback after the result of another you end up nesting them

Parajon: Afroradiohead: promises you chain, it’s a bit easier to reason about

Stilner: Masella: that’s a good point

Masella: Afroradiohead: what Games said is what i said before about “linearizing”. instead of an arrow, it’s a line

Tinkle: One callback after the result of another, you end up nesting it.

Feraco: Instead of an arrow, it’s a line. okay gotta process all that

Farraj: Hullo. wondering if anyone could ***ist me here. im playing around with a scrolling function where if user is at the top of the page, and they scroll, the page will scroll down to the next block: http://jsfiddle.net/g4mrmga9/5/ —- if you scroll up the page slowly and get to the top, it scrolls back down again, if you scroll quick its OK. anyone know what i need to stop it from activating on the slow upscroll near the to

Striplin: Afroradiohead: yes because results are delivered asynchronously remember that

Masella: Afroradiohead: http://blog.4psa.com/the-callback-syndrome-in-node-js/ click the “expand” under “What It Is”

Fogleman: Afroradiohead: so thing’thing’, function err, result { doAsyncThingWithresult, function err, result { doTaskNextwithresult, function err, result { //etc }} }

Baldassara: Http://jsfiddle.net/g4mrmga9/6/ i removed the click here link because that has nothing to do with this

Fent: God that’s ugly, who writes code like that