1.0.1 • Published 11 years ago

define v1.0.1

Weekly downloads
270
License
-
Repository
github
Last release
11 years ago

DefineJS

DefineJS is an Asynchronous Module Definition wrapper for Node. Writing modules in AMD style is convenient when code is shared between Node and a browser. The client needs to use an AMD loader like RequireJS.

Installation

Add a "define": "1.0" dependency to your project's package.json and run npm install, or use npm install define to install manually.

How To Use

In your app's main script, require('define'). This will add define as a global so it's available everywhere else in the application automatically. See examples/shared-code for a working example web server.

DefineJS is Global

DefineJS installs define as a global when it's loaded. The makes define available everywhere else in the application without any special workarounds in each file.

If you don't want a global definition, do the following in your app's main script:

require('define').noConflict();

then, for individual modules that need define:

if (typeof define === 'undefined') {
    var define = require('define');
}

However, if you prefer this approach and you're using RequireJS for the client-side loader anyway, you should probably just use the similar amdefine convention because the RequireJS optimizer strips it away.

See Also

Refer to the AMD Wiki for more information about AMD.

1.0.1

11 years ago

1.0.0

12 years ago

0.4.5

13 years ago

0.4.4

13 years ago

0.4.3

13 years ago

0.4.2

13 years ago

0.4.1

13 years ago

0.4.0

13 years ago

0.3.1

13 years ago

0.3.0

13 years ago

0.2.5

13 years ago

0.2.4

13 years ago

0.2.3

13 years ago

0.2.2

13 years ago

0.1.6

13 years ago

0.1.5

13 years ago

0.1.1

13 years ago

0.1.0

13 years ago