-
Recent Posts
Archives
Categories
Meta
Tag Archives: javascript
React v16.3.0: New Lifecycle Events and Context API
React 16.3.0 just got released. Next to being able to forward refs and some changes to the lifecycle events it also sports a new Context API which I’ve written about before. Even though the introductory blogpost over at the React … Continue reading
Video Music – Make music by flashing colored items in front of your webcam
This makes music and needs access to your camera. The average hue from your camera controls which chord will play. Video Music →
Working with Houdini’s new CSS Typed Object Model (Typed OM)
Chrome 66 will add support for Houdini’s Typed OM. Eric Bidelman from Google has documented how we can use this. CSS now has a proper object-based API for working with values in JavaScript. The days of concatenating strings and subtle … Continue reading
Using the new Async Clipboard API
Shipping with Chrome 66 is an implementation of the new Async Clipboard API. Its asynchronous nature makes it the preferred way – over document.execCommand – to perform copy-paste operations in the browser. // Write Text to the Clipboard (e.g. copy) … Continue reading
Making a Deep Copy of an Object in JavaScript
In JavaScript, when cloning an object via Object.assign({}, obj) or by destructuring it (e.g.{…obj}, only shallow copies are created. Surma has explored some unusual ways – other than JSON.parse(JSON.stringify(obj)); to create an actual deep copy: MessageChannel History API Notification API … Continue reading
Run your tests using Jest & Puppeteer with jest-puppeteer
With jest-puppeteer – and its included expect-puppeteer assertion library – it’s possible to use Puppeteer within your Jest tests. Writing integration test can be done using Puppeteer API but it can be complicated and hard because API is not designed … Continue reading
What’s next for React? Beyond React 16
Dan Abramov – of Redux fame – just spoke at JSConf Iceland 2018 previewing two new features that will make it in a future version of React. The first demo shows time slicing, which can be translated to async rendering: … Continue reading
React’s new context
(React 16.3.0)
One of the new things in React 16.3.0 is a new context API: Typically, data in a React application is passed top-down (parent to child) via props. But sometimes it’s useful to pass values through multiple levels of abstraction without … Continue reading
WTFJS with Math (or why 0.1 + 0.2
results in 0.30000000000000004
)
A few fun little Math-related wtfjs examples. A classic one is adding an empty Array and an empty Object: [] + {} // ‘[object Object]’ {} + [] // 0 If you’re looking for a hint: Coercion. JS WTF with … Continue reading