Comparing version 2.3.4 to 2.4.0
12
index.js
@@ -66,4 +66,4 @@ 'use strict'; | ||
function Constructor() { | ||
if (prototypeAdditions.preInitialize) { | ||
prototypeAdditions.preInitialize.apply(this, arguments); | ||
if (this.preInitialize) { | ||
this.preInitialize.apply(this, arguments); | ||
} | ||
@@ -73,4 +73,4 @@ | ||
if (prototypeAdditions.postInitialize) { | ||
prototypeAdditions.postInitialize.apply(this, arguments); | ||
if (this.postInitialize) { | ||
this.postInitialize.apply(this, arguments); | ||
} | ||
@@ -150,4 +150,4 @@ } | ||
* @property {function} [initialize] - Additional constructor code for new object. This method is added to the new constructor's prototype. Gets passed new object as context + same args as constructor itself. Called on instantiation after similar function in all ancestors called with same signature. | ||
* @property {function} [preInitialize] - Called before the `initialize` cascade. Gets passed new object as context + same args as constructor itself. | ||
* @property {function} [postInitialize] - Called after the `initialize` cascade. Gets passed new object as context + same args as constructor itself. | ||
* @property {function} [preInitialize] - Called before the `initialize` cascade. Gets passed new object as context + same args as constructor itself. If not defined here, the top-most (and only the top-most) definition found on the prototype chain is called. | ||
* @property {function} [postInitialize] - Called after the `initialize` cascade. Gets passed new object as context + same args as constructor itself. If not defined here, the top-most (and only the top-most) definition found on the prototype chain is called. | ||
*/ | ||
@@ -154,0 +154,0 @@ |
{ | ||
"name": "extend-me", | ||
"version": "2.3.4", | ||
"version": "2.4.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "description": "Yet another Backbone-like class extender", |
# extend-me | ||
Yet another Backbone-like class extender | ||
### Update history | ||
#### v2.4.0 | ||
Previously, on instantiation, the `preInitialize` and `postInitialize` methods were called if and only if they were defined on the subclass's (extended object's) own prototype. This has been changed so that the "top" such methods on the prototype chain are now called, whether defined on the extended class or on an ancestor class. As before, these methods are called before and after the `initialize` cascade, respectively. Unlike `initialize`, however, there is no cascade; only the top most method is ever called. | ||
This was an oversight and the workaround has been to forward the calls by redefining new methods with these names whose sole function was to forward the call to `this.super`. This change is backwards compatible with that workaround; it will simply call the forwarding method as before. However, it is now safe to remove the forwarding methods altogether and the call will be made for you. | ||
This can be considered a breaking change because previously without the workarounds, such ancestor methods were not executed. If you were dependent on this unlikely scenario, you can restore that behavior by defining new methods with these names as no-ops. | ||
### Require/include | ||
@@ -5,0 +14,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14678
130