GithubHelp home page GithubHelp logo

minion's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

minion's Issues

Repeat require statement in subclasses

If I define a Class like

minion.define("core.facade", {

    require : [
        "core.control.Controller",
        "core.model.Model",
        "core.view.View",
    ],

    Facade : minion.extend("minion.Singleton", {
})

and then create a subclass of Facade, I have to repeat the require statement:

minion.define("application.facade", {

    require : [
        "core.control.Controller",
        "core.model.Model",
        "core.view.View",
    ],

    ApplicationFacade : minion.extend("core.facade.Facade", {
})

Is this correct? My expectation was that I wouldn't have to repeat the require statement.

Peter

How to create an API

From the HTML wrapper, I need access to some methods in some of my own classes (instances in an already bootstrapped application) that extend minion.class or minion.singleton. What is the best way to accomplish this?

I was thinking I should use minion.get but all I'm getting is:

Uncaught TypeError: Object function ()
{
if (arguments[0] !== "no_init")
{
/*
Handy for referencing dependencies. If a Class requires example.Test, then you can reference said class
in any method by this.__imports.Test;

    */
    if (!_class.prototype.hasOwnProperty("__imports"))
    {
        _class.prototype.__imports = minion.use(this.__dependencies, {});
    }

    if (!this.__preInit)
    {
        for (var attr in _perInstanceProps)
        {
            if (_perInstanceProps.hasOwnProperty(attr))
            {
                this[attr] = _copyTo({}, _perInstanceProps[attr]);
            }
        }

        // All real construction is actually done in the init method
        return this.init.apply(this, arguments);
    }
    else
    {
        return this.__preInit.apply(this, arguments);
    }

}

} has no method 'getProxyName'

require in my own subclasses not working?

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?

__preDefine

__preDefine hook to add dynamic properties/methods to a class after it is defined.

__preDefine : function () {

    for(var f in this.fields) {
        // Do something cool here...
    }

}

This will allow you to modify a Class after all it's dependencies are loaded and after all other properties are set.

Namespace mapping

Provide a way to map an entire namespace to a separate class path:

minion.provides("namespace.*", "path/to/namespace/js/");

Use static properties in the class itself

I want to define application constants (to avoid using strings for events all over the place) and am using the __static object. But, it seems that I cannot use these static properties in the class where I've defined the __static object?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.