JavaScript


Thursday, August 14th, 2008

Secrets of the JavaScript Ninja: A sneak peak for Ajaxians

Category: Books, JavaScript

John Resig is working on the Secrets of the JavaScript Ninja book, which I am sure will be a success. Manning has been kind enough to give us a sneak peak at some of the chapters: How closures work This content introduces the closure, an important aspect of JavaScript, and describes its use. It goes Read the rest…

Posted by Dion Almaer at 6:59 am
30 Comments

++++-
4.1 rating from 52 votes

Wednesday, August 13th, 2008

ECMAScript Harmony: Coming together after Oslo

Category: JavaScript, Standards

I discussed my worries about JavaScript 2 recently. I could only do so as I saw some light at the end of the tunnel. That light came from an ECMA meetup in Oslo where it seems people came together to rally behind the idea that something needs to be done. Brendan Eich posted to a Read the rest…

Posted by Dion Almaer at 5:56 pm
13 Comments

++++-
4.1 rating from 24 votes

Prefer Ruby syntax? See Red, and your Ruby will convert to JS

Category: JavaScript, Ruby

I am a fan of Ruby, and when I saw Red the framework that allows you to write Ruby and get JavaScript out the other end I was excited. It allows you to write this: < View plain text > ruby class MyClass    @@my_var = 500        def initialize(arg)      @arg Read the rest…

Posted by Dion Almaer at 6:28 am
10 Comments

+++--
3 rating from 35 votes

Tuesday, August 12th, 2008

Squirreling out the Fish on the iPhone

Category: iPhone, JavaScript, Mobile, Performance

< View plain text > HTML <script type="text/javascript"> function recurse(n) {     if (n > 0) {         return recurse(n – 1);     }     return 0; }   try {     // recurse(43687);  // Highest that works for me in WebKit             Read the rest…

Posted by Dion Almaer at 6:11 am
1 Comment

++++-
4.1 rating from 24 votes

Monday, August 11th, 2008

MockMe: A new JavaScript mocking framework

Category: JavaScript, Testing

Johannes Link is an Agile fellow who wasn’t 100% happy with the existing JavaScript unit test frameworks, and he explained why. He gives an example: < View plain text > javascript testDoubleSpeaker: function() { with(this) {     var actualMsg = null;     var mockSay = function(msg) {       actualMsg = msg; Read the rest…

Posted by Dion Almaer at 8:22 am
7 Comments

+++--
3.4 rating from 20 votes

Thursday, August 7th, 2008

Enjoying the Observer pattern with custom events

Category: JavaScript

I created an introductory example discussing custom events as an implementation of the Observer pattern. I posted this on my personal blog first and quickly got a port from my Prototype version to Malte’s jQuery port (and now we have a DOMAssistant and Appcelerator versions). I hope others keep them coming so we can aggregate Read the rest…

Posted by Dion Almaer at 7:59 am
10 Comments

+++--
3.8 rating from 22 votes

Wednesday, August 6th, 2008

Code on Demand: How JavaScript is RESTful

Category: JavaScript

In the code-on-demand style, a client component has access to a set of resources, but not the know-how on how to process them. It sends a request to a remote server for the code representing that know-how, receives that code, and executes it locally. The above quote comes from the infamous thesis by Roy Fielding Read the rest…

Posted by Dion Almaer at 11:11 am
2 Comments

+++--
3.6 rating from 16 votes

Introducing HTML into an iframe and getting it back

Category: HTML, JavaScript, Tip

Michael Mahemof is working a lot with TiddlyWiki and posted on how the project injects HTML into an iframe, and then get them out later. This enables you to use the browser parser to do its thing: < View plain text > javascript // put it in var doc = iframe.document; if (iframe.contentDocument)   doc Read the rest…

Posted by Dion Almaer at 11:07 am
7 Comments

+++--
3 rating from 44 votes

Monday, August 4th, 2008

NoGray Visual Time Picker

Category: Component, JavaScript

The NoGray Time Picker is a component that lets you add a time picker that is visual. The clock shows up, and you move the hands to wherever you need to be. All via a simple: < View plain text > javascript var tp = new TimePicker(‘time2_picker’, ‘time2’, ‘time2_toggler’, {format24:true}); Or a more complex version Read the rest…

Posted by Dion Almaer at 7:54 am
15 Comments

+++--
3.3 rating from 36 votes

Wednesday, July 30th, 2008

Light-weight JSON Binding Framework

Category: JavaScript

In my other life as a desktop application developer (which due to a mix of Fluid, AIR, Prism, canvas, SVG, and Flash is threatening to converge on my Ajax life) I’ve long been a fan of data-binding frameworks that make it easy to have a form automatically synchronize with backing data structures, saving you from Read the rest…

Posted by Ben Galbraith at 9:59 am
13 Comments

+++--
3.9 rating from 17 votes

onJSReady Prototype Plug-in

Category: JavaScript, Prototype

In a follow-up to our post a few days ago on parallelizing JavaScript loading and firing an event when loading is done, Stefan Hayden wrote a Prototype extension (based on onDOMReady) that makes it easy for you to execute your code when all JavaScript is loaded: < View plain text > javascript Event.onJSReady(function () { Read the rest…

Posted by Ben Galbraith at 9:30 am
3 Comments

++++-
4.1 rating from 27 votes

Tuesday, July 29th, 2008

Book review: “JavaScript: The Good Parts” by Crockford

Category: Book Reviews, Books, JavaScript

I heart David Flanagan. I’m making my way through “The Ruby Programming Language” this summer. Its exhaustiveness really satisfies. But a decade ago, my programming Bible was Flanagan’s “JavaScript: The Definitive Guide”. As I transitioned from a career in content to a career in code, “the Rhino book” taught me everything I needed to know Read the rest…

Posted by Dietrich Kappe at 3:51 pm
7 Comments

+++--
3.9 rating from 27 votes

Monday, July 28th, 2008

What’s the Fastest Way to Code a Loop in JavaScript?

Category: Browsers, JavaScript, Performance

Gregory Reimer, frontend engineer for sun.com, has written a barrage of tests to answer the question What’s the Fastest Way to Code a Loop in JavaScript? specifically for large data sets: I built a loop benchmarking test suite for different ways of coding loops in JavaScript. There are a few of these out there already, Read the rest…

Posted by Dion Almaer at 10:15 am
17 Comments

++++-
4.2 rating from 32 votes

Thursday, July 24th, 2008

Getting around the blocking of script

Category: JavaScript, Performance, Yahoo!

Stoyan Stefanov has a post that discusses the issues with browsers blocking on script tags. He discusses the general problem and how YUI has a helper for it by using onreadystatechange and onload: < View plain text > javascript var myHandler = {     onSuccess: function(){         alert(‘:))’);     }, Read the rest…

Posted by Dion Almaer at 7:15 am
6 Comments

+++--
3.7 rating from 19 votes

Wednesday, July 23rd, 2008

window.name meet dojox.io.windowName

Category: Ajax, Dojo, JavaScript

We have written about using window.name as a transport and Kris Zyp has just posted about how Dojo has created a new dojox.io.windowName module. The window.name transport is a new technique for secure cross-domain browser based data transfer, and can be utilized for creating secure mashups with untrusted sources. window.name is implemented in Dojo in Read the rest…

Posted by Dion Almaer at 7:08 am
7 Comments

+++--
3.7 rating from 60 votes

Getting to know GWT JSNI; Including talking to GWT code from JavaScript

Category: GWT, JavaScript

Bruce Johnson has written an expansive post on understanding the GWT JavaScript Native Interface (JSNI). It starts out with the piece that some people know about, namely inlining native JavaScript such as this: < View plain text > java // Java method declaration… native String flipName(String name) /*-{   // …implemented with JavaScript   var Read the rest…

Posted by Dion Almaer at 6:43 am
Comment here

+++--
3.9 rating from 21 votes