8000 require in my own subclasses not working? · Issue #8 · gigafied/minion · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
require in my own subclasses not working? #8
Open
@plorent

Description

@plorent

If I have a class like:

minion.define("core.command", {

    SGSimpleCommand : minion.extend("core.observer.SGEventDispatcher", {

        execute : function ()
        {
            throw new Error("Override execute in your subclass");
        }
    })
});

And I extend this class:

minion.define("application.control", {

    PrepareViewCommand : minion.extend("core.command.SGSimpleCommand", {

        require : [
            "application.view.components.ViewComponent"
        ],

        execute : function (event)
        {
            var el = document.getElementById(event.body);
            el.appendChild(new this.__imports.ViewComponent());
        }
    })
});

then the require doesn't seem to work in the subclass as new this.__imports.ViewComponent() turns up as undefined. I can only get it to work if I use:

minion.define("application.control", {

    PrepareViewCommand : minion.extend("core.command.SGSimpleCommand", {

        execute : function (event)
        {
            var el = document.getElementById(event.body);
            minion.require(["application.view.components.ViewComponent"], function (ViewComponent)
            {
                el.appendChild(new ViewComponent());
            });
        }
    })
})

Is this expected behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0