Sending/Getting messages to/from a React Native Webview

Enter react-native-webview-bridge, a JavaScript bridge between your React Native app and a WebView contained inside it: var WebViewBridge = require('react-native-webview-bridge'); const injectScript = ` (function () { if (WebViewBridge) { WebViewBridge.onMessage = function (message) { if (message === "hello from react-native") { WebViewBridge.send("got the message inside webview"); } }; WebViewBridge.send("hello from webview"); } }()); `; …

State of the Art JavaScript in 2016

So, you’re starting a brand new JavaScript front end project or overhauling an old one, and maybe you haven’t kept up with the breakneck pace of the ecosystem. Or you did, but there’s too many things to choose from. React, Flux, Angular, Aurelia, Mocha, Jasmine, Babel, TypeScript, Flow, oh my! Well, the good news is …

Maybe we could tone down the JavaScript

Doing mostly JavaScript stuff it might sound weird to some that I wholeheartedly agree with this piece: I’m not saying that genuine web apps like Google Maps shouldn’t exist […] I’m saying that something has gone very wrong when basic features that already work in plain HTML suddenly no longer work without JavaScript. JavaScript is …

Exif.js – JavaScript library for reading EXIF image metadata

Following up on yesterdays “Read EXIF thumbnail from JPG image using JavaScript” I stumbled upon Exif.js, a library which reads EXIF meta data – and not just the thumbnail – from JPEG images. Usage is simple: EXIF.getData(imageElement, function() { alert(EXIF.pretty(this)); }); It’s also possible to get single values: EXIF.getData(imageElement, function() { var make = EXIF.getTag(this, …

JavaScript Photo Sphere Viewer

See the Pen Photosphere Demo by Bramus! on CodePen. Photo Sphere Viewer is a JavaScript library that allows you to display 360×180 degrees panoramas on any web page. Panoramas must use the equirectangular projection and they can be taken with Photo Sphere, the camera mode brought by Android 4.2 Jelly Bean. Photo Sphere Viewer uses …

Read EXIF thumbnail from JPG image using JavaScript

Little demo by @codepo8 which reads the thumbnail out of the EXIF data of an image: The code itself is very simple: it opens a FileReader and seeks for the second occurrence (*) of 0xFF 0xD8 (Start of Image) along with its following 0xFF 0xD9 (End of Image). All bytes in between are the thumbnail …

Vibrant.js – Extract prominent colors from an image

Usage is simple: var vibrant = new Vibrant(img); var swatches = vibrant.swatches() for (var swatch in swatches) if (swatches.hasOwnProperty(swatch) && swatches[swatch]) console.log(swatch, swatches[swatch].getHex()) Works by reading in the image, placing it onto a <canvas> element, and then getting all pixel information from that canvas. Vibrant.js →

Node debugging with TraceGL

TraceGL transforms your JavaScript, injecting monitoring code that produces a log of everything that happens. This log is streamed from the target – via the traceGL node.js process – to the UI for visualisation. The UI tries to display the resulting huge amount of information fast, and uses webGL to render everything. In the video …