Skip to content

Commit

Permalink
Merge pull request #31 from foretagsplatsen/basicInitialize
Browse files Browse the repository at this point in the history
Introduce `basicInitialize`
  • Loading branch information
BenjaminVanRyseghem authored Oct 28, 2016
2 parents ccffa3a + 9135286 commit 41068b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
11 changes: 10 additions & 1 deletion dist/klassified.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,15 @@ define('object',[], function() {
*/
my.initialize = function() {};

/**
* Offer a hook for subclasses to allow them to control more
* specifically the initialization process (especially the order).
*/
my.basicInitialize = function() {
var args = Array.prototype.slice.apply(arguments);
my.initialize.apply(this, args);
};

/**
* Throws an error because the method should have been overridden.
*/
Expand Down Expand Up @@ -597,7 +606,7 @@ define('object',[], function() {
}

if (!notFinal) {
my.initialize(spec);
my.basicInitialize(spec);
}

return instance;
Expand Down
2 changes: 1 addition & 1 deletion dist/klassified.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ define([], function() {
*/
my.initialize = function() {};

/**
* Offer a hook for subclasses to allow them to control more
* specifically the initialization process (especially the order).
*/
my.basicInitialize = function() {
var args = Array.prototype.slice.apply(arguments);
my.initialize.apply(this, args);
};

/**
* Throws an error because the method should have been overridden.
*/
Expand Down Expand Up @@ -165,7 +174,7 @@ define([], function() {
}

if (!notFinal) {
my.initialize(spec);
my.basicInitialize(spec);
}

return instance;
Expand Down

0 comments on commit 41068b0

Please sign in to comment.