Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly make some application methods chainable #65

Closed
jonathanamartin opened this issue May 27, 2015 · 2 comments
Closed

Possibly make some application methods chainable #65

jonathanamartin opened this issue May 27, 2015 · 2 comments

Comments

@jonathanamartin
Copy link

Hey very nice app architecture framework. Where I work we have a need to use progressive enhancement quite a bit and I found most other app architecture frameworks didn't make it easy to serve HTML from the server. We just needed something simple to help organize our JavaScript. This looks to fit the bill.

On to my question. We'd like to lazy-load not only the module HTML but also the JavaScript file associated with it.

From the few tests I've done it looks to be possible, we'd just have to make sure each T3 component starts itself rather than using the Box.Application.init method (at least I think that'll work.. if there's a cleaner way... I'm all ears).

With that said, would it be possible to make Box.Application.addModule, addService, etc. return an instance of the application instead of undefined. This way I could do something like the following:

Box.Application.addModule('some-module', function(context) {

    'use strict';

    return {

        init: function() {

    },

    destroy: function() {

        }
    };

}).start(document.getElementById('some-module'));

This is really more of a stylistic preference but would be nice to have.

@nzakas
Copy link
Contributor

nzakas commented May 28, 2015

Here's some info on dynamically loading modules:
http://t3js.org/docs/guides/dynamic-loading

I don't see any reason we can't add chaining. @j3tan thoughts?

@jonathanamartin
Copy link
Author

Hey thanks!

@nzakas nzakas closed this as completed in f644641 Aug 5, 2015
nzakas added a commit that referenced this issue Aug 5, 2015
Update: Make Box.Application chainable (fixes #65)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants