sitepoint.com sitepoint.com

Component-based Web Apps with React

ReactJS is a toolkit for building component-based web applications. React shines at being fast and effortless by its clever use of DOM simulation to minimize the amount of DOM manipulations and look-ups performed. React components are written in a blend of JavaScript and XML, but are compiled into pure Javascript using React’s compiler tools. Here is an example of a component that displays the current time and pops up an alert...

jspro.com jspro.com

Six Things You Might Not Know About Promises

Promises are a simple concept, and even if you haven’t had a chance to use them, you may have already read up on them. They are a valuable construct that enables asynchronous code to be structured in a more readable fasion, rather than as a mess of nested anonymous functions. This article touches on six things that you might not know about promises. Before diving into the list, here is a quick reminder of what JavaScript promises...

sitepoint.com sitepoint.com

Six Things You Might Not Know About Promises

Promises are a simple concept, and even if you haven’t had a chance to use them, you may have already read up on them. They are a valuable construct that enables asynchronous code to be structured in a more readable fasion, rather than as a mess of nested anonymous functions. This article touches on six things that you might not know about promises. Before diving into the list, here is a quick reminder of what JavaScript promises...

sitepoint.com sitepoint.com

HTML5, Older Browsers and the Shiv

HTML5 introduced a few semantic elements that are not supported in older browsers. Some of these new elements are no different than generic block elements so they don’t pose any compatibility problems. All you need to ensure compatibility is to add a CSS rule to your website that causes the relevant elements to behave like block elements. But Internet Explorer versions 8 and under pose a challenge. Any element not in the official...

sitepoint.com sitepoint.com

Simple Animations Using requestAnimationFrame

Animating DOM elements involves modifying a CSS style every few milliseconds to give the illusion of movement. This means passing in a callback function to setTimeout and modifying the node’s style object within that callback. Then calling setTimeout again to queue the next animation frame. From the ashes of the phoenix rises a new helper function to write animations called requestAnimationFrame. It started off in Firefox 4 and...