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 classes with ES6 syntax #11

Open
Disorrder opened this issue Mar 3, 2017 · 2 comments
Open

extending classes with ES6 syntax #11

Disorrder opened this issue Mar 3, 2017 · 2 comments
Labels
Request A cool feature request for the library

Comments

@Disorrder
Copy link

There is unable to extend classes

var robot = require('robot-js');
class Window extends robot.Window {
  constructor(hwnd) {
    super(hwnd);
    this.newProperty = 'hello';
  }
  newFeature(){}
}

var wnd = new Window();
wnd.newProperty; // 'hello' !!! this is weird
wnd.newFeature(); // TypeError: newFeature in not a function
wnd instanceof Window // false
wnd instanceof robot.Window // true

:(

@dkrutsko
Copy link
Member

dkrutsko commented Apr 6, 2017

Hey, so currently robot modules is implemented through functions so I don't think they're compatible with the class structure. I'm thinking of rewriting them to use classes in a future release but I'd like to finish robot 2.1 before starting on this.

@dkrutsko dkrutsko added the Request A cool feature request for the library label Apr 6, 2017
@dkrutsko dkrutsko added this to the Robot-js 3.0.0 milestone Aug 20, 2017
@Disorrder
Copy link
Author

By the way, now with node.js v8.2.3 and robot v2.0.0 it works as expected! Idk what did you changed, may be nothing, but this is not actual any more. Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request A cool feature request for the library
Development

No branches or pull requests

2 participants