Robot/robot-js

extending classes with ES6 syntax

Disorrder opened this issue · 2 comments

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

:(

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.

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 :)