Created
October 10, 2014 18:07
-
-
Save mrkelly/d849dc885b4bae467ee5 to your computer and use it in GitHub Desktop.
Node util inherits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var BasePageObject = function(arg1) { | |
this.arg1 = arg1; | |
}; | |
BasePageObject.prototype.helloWorld = function() { | |
console.log('Hello, World!'); | |
}; | |
module.exports = BasePageObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var util = require('util'), | |
BasePageObject = require('./base.page.object'); | |
var MyPageObject = function(arg1, arg2) { | |
// If needed, this is similar to super() | |
BasePageObject.call(this, arg1); | |
this.arg2 = arg2; | |
}; | |
util.inherits(MyPageObject, BasePageObject); | |
MyPageObject.prototype.printArgs = function() { | |
console.log(this.arg1, this.arg2); | |
}; | |
module.exports = MyPageObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var MyPageObject = require('./my.page.object'); | |
var myPageObject = new MyPageObject('foo', 'bar'); | |
myPageObject.printArgs(); | |
myPageObject.sayHello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment