Skip to content

Comment on (fab) - A pure javascript DSL for building async web appsparent

Comments

I did a double-take looking at that syntax. I assume that fab (and all of the other bracketed expressions) return functions that chain together? Pretty ingenious. Plus you can detect the end of the chain when one of the methods is passed in "fab" again.

I think I can say that this is the best (ab)use of the syntax I've ever seen, well done. :)

Yeah, a (fab) function just returns itself. It's like jQuery's chaining, but using argument signatures instead of object methods to delegate work. The last (fab) is just a way to indicate the chain is over so that a listener can be returned, and has the additional benefit of making it look declarative.

Thanks for pointing that out, I've been sitting looking at how that could possibly work for a while.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.