Binding Arguments with Bind
One of my favorite and most essential
Function method is
bind to simply bind a method's call to its host object, but did you know you can also bind arguments with the host object?
You've probably done something like this:
this._onTargetAvailable = this._onTargetAvailable.bind(this);
That pattern is frequently used, especially in classed-based code or when passing callback functions. What you may not often see is bound arguments:
this._onTargetAvailable = this._onTargetAvailable.bind(
Binding arguments gives you more power in how your bound function is used! Whenever
onTargetAvailable is called, the arguments you provide will be in that order, and any additional arguments will be added to the end of the argument list!
I love almost every part of being a tech blogger: learning, preaching, bantering, researching. The one part about blogging that I absolutely loathe: dealing with SPAM comments. For the past two years, my blog has registered 8,000+ SPAM comments per day. PER DAY. Bloating my database...
One event that's always been lacking within the document is a signal for when the user is looking at a given tab, or another tab. When does the user switch off our site to look at something else? When do they come back?
Flexbox was supposed to be the pot of gold at the long, long rainbow of insufficient CSS layout techniques. And the only disappointment I've experienced with flexbox is that browser vendors took so long to implement it. I can't also claim to have pushed flexbox's limits, but...