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

Inherit from javascript function #38

Open
lcnvdl opened this issue Jun 16, 2016 · 1 comment
Open

Inherit from javascript function #38

lcnvdl opened this issue Jun 16, 2016 · 1 comment

Comments

@lcnvdl
Copy link

lcnvdl commented Jun 16, 2016

Hi! I'm using jsface for the new objects of my project, but I have a lot of "legacy objects", like:

var Robot = function() {

    this.getRotation = function() { return 0; }

};

I'm trying to create a child of Robot using jsface, like:

var RobotChild = Class(Robot, function() {
    return {
    };
});

But, when I do:

var robot = new RobotChild();

I get an empty instance.

Regards

@tnhu
Copy link
Owner

tnhu commented Jun 24, 2016

What do you mean you get an empty instance? I run the snippet, robot does have properties:

typeof robot; // "object"
typeof robot.getRotation; // "function"
robot.getRotation(); // 0

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

2 participants