background preloader

Javascript

Facebook Twitter

Sign in with your Apple ID - Apple Developer. Safari and settimeout javascript function. Converting an existing Backbone.js project to Require.js. Recently, I've undertaken the task of converting a rather large Backbone.js app to using Require.js.

Converting an existing Backbone.js project to Require.js

Since the process can get tricky at times, here's a quick recap of what I had to do to get it done. 0. Why use Require.js in the first place? Most projects start small. A couple of script tags that include jQuery (or Zepto, or whatever else you are using), a couple of plug-ins, and your own code. Require.js helps us define exactly what our component depends on, almost like "regular" imports in other development environments.

Comparatif des outils de développement multi-plateforme mobile. Jquery Mobile – PhoneGap – Retours d’expérience et bonnes pratiques. Lors du développement d’une application mobile, nous sommes souvent confrontés au choix “application native” ou “site web mobile”.

Jquery Mobile – PhoneGap – Retours d’expérience et bonnes pratiques.

Dans cet article, nous allons présenter l’approche que nous avons eu pour le développement d’une application mobile qui mixe à la fois un framework html mobile classique avec l’utilisation de JQuery Mobile ainsi que des fonctionnalités natives grâce à PhoneGap. Nous verrons ensuite les bonnes pratiques que nous avons pu faire ressortir ainsi que les limites rencontrées. Notre application. Know yourengines velocity2011. Javascript, retour aux bases : constructeur, prototype et héritage. Depuis quelques temps, l’utilisation du javascript se démocratise.

Javascript, retour aux bases : constructeur, prototype et héritage

De langage permettant de faire clignoter un texte ou défiler un bandeau de pub sur votre site multimania, il est progressivement devenu un outil à part entière de toute application web, jusqu’au point, atteint récemment, d’être auto suffisant, et ainsi de voir émerger un certain nombre de librairies permettant de réaliser la partie interface d’une application (presque) exclusivement en javascript.

Pourtant, on partait de loin ! What is the 'new' keyword in JavaScript. Is The Death Of JavaScript Upon Us, Or Is A Universal Language Transformation Underway? Editor’s note: Péter Halácsy is co-founder and CTO of Prezi.

Is The Death Of JavaScript Upon Us, Or Is A Universal Language Transformation Underway?

Follow him on Twitter @halacsy. Startups identify with JavaScript. When you’re just starting out, you need to be dynamic. You need to be flexible. You need to be able to bust out a prototype that just works, and you need to be able to change it on a dime without recompiling your code. Today, JavaScript is no longer a startup, and it’s no longer just startups that are using it. Those in the latest generation of JavaScript engines deliver incredible performance gains, but these still aren’t enough. Once your codebase reaches hundreds of thousands of lines of code, and it’s all written in a dynamic language such as JavaScript, development velocity starts to suffer.

Somebody needs to address these limitations so that companies can continue to innovate and build amazing applications for the web. AMD/RequireJS shim plugin for loading incompatible JavaScript. When Jeremy Ashkenas decided to remove AMD compatibility completely from the DocumentCloud projects, Underscore & Backbone I wasn't quite sure what to think. On one hand it would have been great for the community to have decided on an open standard to write and load modules.

On the other hand, it seemed like a dark path for a library to head down if it wasn't completely on board. This got me thinking about Backbone Boilerplate and what I could do to help provide the desired RequireJS/AMD interoperability. Creating a boilerplate that patches the source files of the libraries has been done to death and only puts a band-aid on the problem instead of solving it.

On a more personal opinion, I'm never in favor of patching third-party JavaScript by hand, unless its an extreme circumstance (patching an exploit). Screw Hashbangs: Building the Ultimate Infinite Scroll. I’m just a student in a field unrelated to computer science, but I’ve been coding for years as a hobby.

Screw Hashbangs: Building the Ultimate Infinite Scroll

So, when I saw the current state of infinite scroll, I thought perhaps I could do something to improve it. I’d like to share what I came up with. (Demo: The impatient can just try it out by scrolling+navigating away+using the back button on the front page of my site. Works in current versions of Safari, Chrome, Firefox.) Js2coffee: convert JavaScript code to CoffeeScript. Writing polyfills in Javascript. Introduction Javascript is notorious for having cross-browser compatibility issues.

Writing polyfills in Javascript

Internet Explorer, Mozilla Firefox, Google Chrome, Safari and Opera all have their own proprietary features and their own subset of the standard features. Different browsers implement each feature in their own way, and this can be a major headache for web developers trying to make things work for everybody. Fortunately, Javascript has enough flexibility and extensibility to bridge some of these gaps between each browser. These bridges are called polyfills. Client Side Frameworks. Isomorphic JavaScript: The Future of Web Apps. By Spike Brehm This post has been cross-posted on VentureBeat.

Isomorphic JavaScript: The Future of Web Apps

At Airbnb, we’ve learned a lot over the past few years while building rich web experiences. We dove into the single-page app world in 2011 with our mobile web site, and have since launched Wish Lists and our newly-redesigned search page, among others.

JQuery

Node.js. JavaScript Garden. Although JavaScript deals fine with the syntax of two matching curly braces for blocks, it does not support block scope; hence, all that is left in the language is function scope. function test() { // a scope for(var i = 0; i < 10; i++) { // not a scope // count } console.log(i); // 10} There are also no distinct namespaces in JavaScript, which means that everything gets defined in one globally shared namespace.

JavaScript Garden

Each time a variable is referenced, JavaScript will traverse upwards through all the scopes until it finds it. In the case that it reaches the global scope and still has not found the requested name, it will raise a ReferenceError. The Bane of Global Variables // script Afoo = '42'; // script Bvar foo = '42' The above two scripts do not have the same effect. Again, that is not at all the same effect: not using var can have major implications. // global scopevar foo = 42;function test() { // local scope foo = 21;}test();foo; // 21 Local Variables.