ES3 Implementation
See original GitHub issueIE6 compatible. Just for fun. Nothing serious. Tell me what you think about this 😄
function Mixin1 (superClass) {
function Mixin1 () {
// Passing constructor arguments
superClass.apply(this, arguments)
}
Mixin1.prototype = new superClass()
// Calling super class method
Mixin1.prototype.callSuperClassMethodExample = function () {
superClass.prototype.superClassMethod()
return this
}
return Mixin1
}
function Mixin2 (superClass) {
function Mixin2 () {
superClass.apply(this, arguments)
}
Mixin2.prototype = new superClass()
Mixin2.prototype.anotherMixinMethod = function () {
alert('Hello from mixin!')
}
return Mixin2
}
// Composing mixins
function Mixin3 (superClass) {
return Mixin2(Mixin1(superClass))
}
// Test it
var Foo = (function () {
function Foo () {
}
Foo.prototype.superClassMethod = function () {
alert('Hello from superClass!')
}
return Mixin3(Foo)
}())
new Foo().callSuperClassMethodExample().anotherMixinMethod()
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Adobe LiveCycle ES3 * Implementation overview
Implement the existing service interface while providing a custom implementation for the service. For example, to provide custom implementation for ...
Read more >[MS-ES3]: Microsoft Implementations
The following Microsoft products implement some portion of the ECMAScript Third Edition specification [ECMA-262-1999]: Windows Internet.
Read more >ES3 Grant Application Companion 22-23
The Enhancing Social and Emotional Skills in Students with IEPs (ES3) discretionary grant provides public school districts with the structures and processes ...
Read more >medikoo/es3-ext: ECMAScript 3 extensions (with ... - GitHub
Provides just basic utilities (and shims) which help setup basic configurations in ES3 engines. See es5-ext project for extensive list of ECMAScript 5...
Read more >Using JavaScript Next Features in an ES3 Enterprise World
I wish it was possible for everyone to use the newer JavaScript features immediately after being finalized and implemented. Browsers and the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think you should use
new
there, since that might run logic meant for the instance when the instance is created, not when the class is defined. I think you can use Object.create (polyfill), if that works in ES3?Oh yep, forgot about those. I think you meant
Object.assign(IcedFrisbyNock, superClass);
, but yeah, good point, ES6 classes do that automatically too.