岁月如歌

用开放的心态,打造专业的人生。

node 0.5.0-pre 支持 seajs 的模块书写格式

with one comment

值得发一篇博客:从 源码 中可以看出,node 0.5.0 支持的异步模块格式和 seajs 兼容:

define(function (require, exports, module) {
  var PI = Math.PI;
  exports.area = function (r) {
    return PI * r * r;
  };
  exports.circumference = function (r) {
    return 2 * PI * r;
  };
});

这意味着 seajs 的模块可以直接运行在 node 上,太赞了。

Advertisements

Written by lifesinger

June 22, 2011 at 18:09

Posted in Articles

One Response

Subscribe to comments with RSS.

  1. 到底 CommonJS 上的 Module 1.0/1.1/1.1.1 这三个版本直接有什么区别?我觉得都一样啊,都是直接把东西放到 exports 去。

    cathsfz

    June 26, 2011 at 12:24


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s