Closed kellyfj closed 8 years ago
Drone.extend and exports are not the same thing. exports is modeled on the commonjs (nodejs) public/private module mechanism. Drone.extend is for adding new methods to the Drone (and also publishes such methods as global functions).
The this
keyword inside the context of a module will refer to the global
object, while the this
keyword inside the context of a Drone.extend function will refer to the Drone.
OK Thanks!
ENVIRONMENT Jars
and ScriptCraft.jar from http://scriptcraftjs.org/download/latest/scriptcraft-3.1.10/
Two functions with the same code inside
versus
House on the left is from the
drone.extend
version, house on the right usesexports
Looks like this variant does work though
But shouldn't
this.doX().doY()
be equivalent to