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

Extending stjs.extend works for everything except the constructor #71

Closed
onigoetz opened this issue Apr 17, 2015 · 1 comment
Closed

Comments

@onigoetz
Copy link
Member

Hi, it's me again :D

You know I'm working on a st-js bridge for React. I'm stuck on the part where I call React.createClass() automatically in stjs.extend() (see https://github.com/onigoetz/react-bridge/blob/master/src/main/js/react/stjs-react.js )

You see in this method, that we completely bypass the stjs.extend() method in favor of React.createClass()

The problem is that the return we do at the end is not taken into account because how the STJS code is generated:

The generated STJS code is:

var Panel = function() {};
stjs.extend(Panel, null, [], function(constructor, prototype) {
    prototype.render = function() {
        return "content";
    };
}, {}, {_: {"IsReactClass": {}}});

But should actually be:

var Panel = stjs.extend(function() {}, null, [], function(constructor, prototype) {
    prototype.render = function() {
        return "content";
    };
}, {}, {_: {"IsReactClass": {}}});

Even when I do _constructor.prototype = React.createClass({}).prototype; the constructor is still the original one which is not what we want...

If you accept this change of generation, I can make a pull Request with the fix.

@onigoetz
Copy link
Member Author

Oops this should have been closed a long time ago, released in 3.1.5

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