0 Replies Last post: Jan 21, 2013 6:29 PM by Henning Kvinnesland  
Henning Kvinnesland Newbie 9 posts since
Jan 21, 2013
Currently Being Moderated

Jan 21, 2013 6:29 PM

Code-completion and requireJS

define(['backbone'], function(Backbone)

{

    return Backbone.View.extend({

        initialize : function()

        {

            _.bindAll(this);

 

            return this;

        },

 

        load : function()

        {

            require(['something'], function(Something){

 

            });

 

            return this;

        }

    });

});

 

Many of our js-files looks something like this. I got jQuery, Underscore and Backbone registered as js-libraries.

Within "load" there is a call to "require". Whenever using require within a define, code-completion becomes unreliable.

 

Any underscore-method is marked as "unresolved function or method".

Inherited methods from Backbone.View, like "listenTo", also becomes unresolved.

The same goes for any references to externals defined by @class.

More Like This

  • Retrieving data ...