var beingWatched = {}; function whatHappened(change) { console.log(change.name + ” was ” + change.type + ” and is now ” + change.object[change.name]); } function somethingChanged(changes) { changes.forEach(whatHappened); } Object.observe(beingWatched, somethingChanged); beingWatched.a = “foo”; // new beingWatched.a = “bar”; // updated beingWatched.a = “bar”; // no change beingWatched.b = “amazing”; // new Object.observe() lets you add …
Tag Archives: javascript
Play Dune 2 in your browser
Fun with face detection, canvas and webcam video
With the getUserMedia API, a video element, a canvas element and LiuLiu’s excellent face detection algorithm, we can easily play around with webcam video data in the browser, plug-in free. Mask overlay experiment: Scaling content experiment: Cool! Fun with face detection, canvas and webcam video → Related: getUserMedia Moustache (via Webappers.com)
jQuery.faceDetection()
Retina.js
Web Animations Preview
A brief introduction to some of the concepts in the Web Animations specification — an attempt to overcome some of the limitations with both CSS and SVG animations and unify them at the same time — currently being defined by Mozilla, Google, and Adobe under the W3C Web Animations 1.0 (Editor’s Draft) →
JAL – Just Another Loader for JavaScript
$loader .load(‘js/jquery.min.js’) .done(function(){ // Stop jQuery from triggering the “ready” event $.holdReady(true) }) .load([ ‘js/script-one.min.js’ , ‘js/script-two.min.js’ ]) .ready(function() { // Allow jQuery to trigger the “ready” event $.holdReady(false) // Start app }); We tested YepNope, which is a great loader, but felt it could be faster. It also had features we didn’t really need. …
Gamma Gallery: A Responsive Image Gallery
Gamma Gallery is an experimental responsive image gallery that attempts to provide an adjustable responsive images approach taking its grid layout and the full slideshow view into account. Both the grid and lightbox are responsive. Gamma Gallery: A Responsive Image Gallery Experiment → Gamma Gallery Demo →
A Few New Things Coming To JavaScript (ES6)
ECMAScript 6 contains a few new features. Addy Osmani gives a nice overview of things that are about to come: Modules (which can replace the revealing module pattern we’re familiar with) and Module Loader Classes (which merely is some syntactic sugar) Object.observe() Default Parameter Values (again syntactic sugar as we already know how to work …
Continue reading “A Few New Things Coming To JavaScript (ES6)”
Logging client-side errors
function logError(details) { $.ajax({ type: ‘POST’, url: ‘http://mydomain.com/api/1/errors’, data: JSON.stringify({context: navigator.userAgent, details: details}), contentType: ‘application/json; charset=utf-8’ }); } window.onerror = function(message, file, line) { logError(file + ‘:’ + line + ‘\n\n’ + message); }; Let’s keep this short. Too few websites log JavaScript errors. Let’s build a simple system to track client-side errors. Makes clever …