Prototypal inheritance made easy - A slight modification on the prime libs
new (require("tastypie/lib/class"))(prototype)
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
prototype |
Object | an object to serve as the instance prototype Properties
|
- Source:
Example
var EventEmitter = require('events').EventEmitter var Options = require('tastypie/lib/class/options'); MyClass = new Class({ extends: require('fs').Stream ,mixin:[ EventEmitter, Options ] ,options:{ isActive: false } ,constructor: function( options ){ this.setOptions( options ) // from options mixin console.log("im the constructor"); EventEmitter.call( this ); } ,work: function(){ console.log('I'm doing work) this.emit('work', this.options.isActive ) } });
Requires
- module:mout/object/hasOwn
- module:mout/object/mixIn
- module:mout/lang/createObject
- module:mout/lang/kindOf
- module:mout/lang/clone
- module:mout/object/merge