PhaultLines

Using cancellation with async iterators in JavaScript

Chrome 63, released in December, included async iterators and the associated for-await-of syntax. As the feature is now official in V8 6.3, it’s also likely to land in the upcoming Node.js 10 release this April. In light of its imminent availability in Node.js, I figured that it was time to start exploring the real-world potential of async iterators on the backend. Combining the async and await keywords with generator functions provides an elegant way to express streaming operations in modern JavaScript applications.

Continue Reading ›

Get the advantages of TypeScript without transpiling

Microsoft’s TypeScript programming language brings many of the advantages of static typing to JavaScript. Although it doesn’t enforce types at runtime, it enables richer static analysis, encourages more safety, and opens the door for better IDE integration. TypeScript code is typically transpiled to standards-based JavaScript so that it can run natively in browsers and Node.js. Given the attractiveness of TypeScript’s benefits, it is unsurprising that adoption is growing at a rapid pace.

Continue Reading ›

How to query an on-disk SearchKit index with PyObjC

OS X comes with a framework called SearchKit that applications can use to index content and support full-text searches. I occasionally run into situations where I want to take advantage of an application’s existing SearchKit index so that I can perform my own full-text searches programmatically. The most recent case arose this weekend while I was attempting to build an Alfred workflow for searching Quiver notes. Quiver uses SearchKit internally to expose full-text search through its own user interface, but it doesn’t have native Spotlight integration yet.

Continue Reading ›

Weekend Project: Leap Motion and Pixi.js

The Leap Motion Controller is an input device that tracks the position of the user’s hands and fingers in 3D space, taking the first step towards the kind of gesture-based computer interaction that we’ve seen in science fiction films like Minority Report. I built a simple space game demo with the Leap Motion JavaScript library and the Pixi.js 2D graphics framework. You can find the complete source code on GitHub.

Continue Reading ›