September 30th, 2010 – by Kris Zyp
For developers that are creating libraries and modules, it is generally preferable to make your code available to as broad of range of users as possible. There are several different module formats in JavaScript (a module is an encapsulation of code that draws on other modules). Picking one format is often mutually exclusive to the other formats. However, in this post I want to demonstrate how you can write JavaScript modules that can be used with multiple module loaders using some simple boilerplate. Of course not all the module loaders necessarily make sense for all modules. If you are writing a module that relies on the Node file system API, it only needs it to work with the NodeJS/CommonJS module format. Likewise, a DOM-based module wouldn’t need to run on Node.
Here we’ll deal with the actual module format, the mechanism of specifying dependencies and exporting or returning functions from the module that can be used by the users. This does not deal with the normalization of the actual APIs of the underlying system, although you might want to take a look at promised-io if you would like normalization of IO interaction across the browser, Node, and Rhino/Narwhal.
Continue reading
Tags: and Persevere 2.0, modules, nodules, pintura, promosed-io, RequireJS, Server-Side JavaScript
Posted in CommonJS, Dojo | 5 Comments
September 29th, 2010 – by blog
At its BlackBerry Developer Conference 2010 (DEVCON 2010), Research In Motion (RIM) demonstrated how the company is pushing its momentum with developers by providing a new web application platform, simplifying enterprise app development, launching both new analytics and advertising services, as well as opening up its BlackBerry Messenger (BBM) social platform to developers.
Continue Reading
Posted in press | No Comments
September 21st, 2010 – by Kris Zyp
Patr (Promise-based Asynchronous Test Runner) is a simple lightweight cross-platform test runner for promised-based applications. Patr executes tests by simply executing functions of an object and is intended to be used in combination with the “assert” module (which is available on NodeJS and Narwhal), so tests can be as simple as:
var assert = require("assert");
tests = {
testSomething: function(){
assert.eq(3, 3);
}
}
require("patr/runner").run(tests);
Continue reading
Tags: Dojo, narwhal, nodejs, unit testing
Posted in CommonJS, Persevere | No Comments
September 20th, 2010 – by Kris Zyp
Promises are a well-established mechanism for modeling future or asynchronous actions. Promises allow asynchronicity while maintaining the core programming principles of composability and encapsulation. Writing asynchronous code in JavaScript can often be a confusing exercise due to the extensive need for callbacks, but promises help to define composable units of asynchronicity to encapsulate actions and reliably separate caller and callee’s concerns.
Promised-IO
Promised-IO utilizes promises as an abstraction for I/O operations on top of Node, Narwhal/Rhino, and the browser (where possible). This serves two purposes. First, this package provides the benefits of promise usage: clean separation of concerns and proper encapsulation of eventual values. Second, Promised-IO provides a consistent normalized interface for I/O that will work on multiple platforms without sacrificing any of the advantages of asynchronous I/O, making it easy to build modules that can be used by developers on many platforms.
Continue reading
Tags: and Persevere 2.0, narwhal, node, nodejs, pintura, Server-Side JavaScript
Posted in CommonJS, Persevere | 11 Comments
September 15th, 2010 – by Kris Zyp
Nodules is a module loader for Node that provides a powerful set of features for application development and distribution. Nodules was written to solve the two major missing pieces of functionality I needed for efficient application development: flexible dependency resolution and module reloading. Nodules runs on top of Node’s simple base module loader, and nicely compliments the base loader with additional functionality. Furthermore, it provides this functionality using idiomatic asynchronous techniques, a smart package layout, and powerful module reloading.
Continue reading
Tags: and Persevere 2.0, narwhal, node.js, nodules, pintura, Server-Side JavaScript
Posted in CommonJS, Persevere | 2 Comments