0

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.

0 comments

Please sign in to leave a comment.