Nicolla R asked the following today on irc,

Are the following expected to be equivalent styles of define()'s?:

define(function(){
define([],function(){ // Note: api doc tool breaks with this
define(["."],function(){

Search Discussions

  • James Burke at May 17, 2011 at 7:09 pm

    On Tue, May 17, 2011 at 3:27 PM, Chris Mitchell wrote:
    Nicolla R asked the following today on irc,

    Are the following expected to be equivalent styles of define()'s?:

    define(function(){
    This will result in converting the function to a string and scanning
    for require('') calls. This is done for simplified CommonJS-like
    wrapping, or for people that like to have the require calls line up
    with the local variable names:
    http://requirejs.org/docs/commonjs.html
    define([],function(){ ? ? ? // Note: api doc tool breaks with this
    This explicitly specifies that the module has no dependencies. No
    function scanning is done. This form, along with including the name
    for the module, is common in a built file where dependency scanning of
    a plain function has already been done so that it can operate in
    systems that do not support Function.prototype.toString() returning
    some semblance of the actual function.
    define(["."],function(){
    This specifies the main package module as a dependency or a name
    matching the current directory name, depending on how you do the path
    config.

    James

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdojo-contributors @
categoriesdojo
postedMay 17, '11 at 6:27p
activeMay 17, '11 at 7:09p
posts2
users2
websitedojotoolkit.org

2 users in discussion

Chris Mitchell: 1 post James Burke: 1 post

People

Translate

site design / logo © 2022 Grokbase