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

Dojo.declare() #3

Open
aramk opened this issue Jan 2, 2013 · 2 comments
Open

Dojo.declare() #3

aramk opened this issue Jan 2, 2013 · 2 comments

Comments

@aramk
Copy link

aramk commented Jan 2, 2013

If I use dojo.declare in place of declare when declaring modules, although my source works fine in the browser this docs parser sets my class to a "string" type in the api browser.

Also, I'm calling dojo.declare in a separate function and then returning the result. I then use this function in place of my imported declare and although I've verified this is working correctly this parser returns an "object" instead of a "class" unless I strictly use the same instance of the "declare" function which I import. Creating a new reference to this declare function also works, but calling it in a function does not.

// Works
define([
    'dojo/_base/declare'
], function (declare) {
    var declare2 = declare;
    return declare2(null, {
        // some stuff
    });
});


// Doesn't work
define([
    'dojo/_base/declare'
], function (declare) {
    var me = this;
    var declare3 = function () {
        // some stuff
        return declare.apply(me, arguments);
    };
    return declare3(null, {
        // some stuff
    })
});
@aramk
Copy link
Author

aramk commented Jan 2, 2013

Here's a more concrete example which I have verified works in practice but the api viewer shows the class as being a string.

define([
    'dojo/_base/declare'
], function (declare) {
    var oldDeclare = declare;
    declare = function () {
        // some stuff
        return oldDeclare.apply(this, arguments);
    };
    return declare(null, {
        // some stuff
    });
});

There aren't any errors during parsing.

@aramk
Copy link
Author

aramk commented Jan 2, 2013

Also the same issue here:

define([
    'dojo/_base/declare'
], function (declare) {
    var a = declare(null, {
        // some stuff
    });
    function test() {
        return a;
    }
    a = test();
    return a;
});

This only works if I remove a = test();, even though it is returning the same object... Replacing that line with a = a does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant