[joose] Namespace.Depended and the use builder

2 views
Skip to first unread message

John Mark Hawley

unread,
Dec 9, 2010, 12:25:05 PM12/9/10
to joos...@googlegroups.com
Hmm. I'm doing SOMETHING wrong here, but I can't tell what.

From an html file:

use('com.nilbog.game.client.Application', function () {
    var app = new com.nilbog.game.client.Application();
    app.start();
});

Now, from what I've read, Application and anything it depends on in the 'use' builder should be available before the use() callback, above, is called. However, I'm getting an error.

Here's the contents of my com.nilbog.game.client.Application.js file:

Module('com.nilbog.game.client', function (m) {
    Class('Application', {
        use: ['com.nilbog.game.client.MessageWindow'],
        has: { messageWindow: { is: 'ro' } },
        methods: {
            start: function () {
                this.messageWindow = new m.MessageWindow();
            }
        }
    });
});

...and of the MessageWindow.js file:

Module('com.nilbog.game.client', function (m) {
    Class('MessageWindow', {
        has: {},
        methods: {}
    });
});

And here's my error. MessageWindow.js loads shortly after this error, AFTER the use() callback has already fired ;(

Uncaught Module [com.nilbog.game.client.Application] may not be instantiated.

Any help?

--
John Mark Hawley
Design Technologist, Nilbog Group
http://www.nilbog.com
AIM: jmhnilbog
Twitter: johnmarkhawley

Nickolay Platonov

unread,
Dec 9, 2010, 12:43:34 PM12/9/10
to joos...@googlegroups.com
Seems like a bug, probably related to the wrapping Modules. This use case is undertested in JooseX.Namespace.Depended..

Temporary workaround will be to declare the Application class w/o wrapping module:

Class('com.nilbog.game.client.Application', {

        use: ['com.nilbog.game.client.MessageWindow'],

        has: { messageWindow: { is: 'ro' } },

        methods: {
            start: function () {
                this.messageWindow = new m.MessageWindow();
            }
        }
});

Nickolay


--
You received this message because you are subscribed to the Google Groups "Joose" group.
To post to this group, send email to joos...@googlegroups.com.
To unsubscribe from this group, send email to joose-js+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joose-js?hl=en.

Nickolay Platonov

unread,
Dec 9, 2010, 1:25:50 PM12/9/10
to joos...@googlegroups.com
has been fixed in https://github.com/SamuraiJack/JooseX-Namespace-Depended/commit/8844086a218f65e048727cdde584ea8541ebf703

Trying to release the update in `npm`, but seems its broken again..

Nickolay Platonov

unread,
Dec 10, 2010, 1:14:20 PM12/10/10
to joos...@googlegroups.com
Ok, npm is now fixed and the update published.
Reply all
Reply to author
Forward
0 new messages