summaryrefslogtreecommitdiffstats
path: root/fastdom.js
diff options
context:
space:
mode:
Diffstat (limited to 'fastdom.js')
-rw-r--r--fastdom.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/fastdom.js b/fastdom.js
index 919ac4f..dff794b 100644
--- a/fastdom.js
+++ b/fastdom.js
@@ -106,9 +106,8 @@ FastDom.prototype = {
* @example
*
* var myFastdom = fastdom.extend({
- * // called on creation
* initialize: function() {
- *
+ * // runs on creation
* },
*
* // override a method
@@ -130,7 +129,7 @@ FastDom.prototype = {
if (typeof props != 'object') throw new Error('expected object');
var child = Object.create(this);
- Object.assign(child, props);
+ mixin(child, props);
child.fastdom = this;
// run optional creation hook
@@ -151,7 +150,6 @@ FastDom.prototype = {
*
* @private
*/
-
function scheduleFlush(fastdom) {
if (!fastdom.scheduled) {
fastdom.scheduled = true;
@@ -203,7 +201,6 @@ function flush(fastdom) {
*
* @private
*/
-
function runTasks(tasks) {
debug('run tasks');
var task; while (task = tasks.shift()) task.fn.call(task.ctx);
@@ -221,6 +218,19 @@ function remove(array, item) {
return !!~index && !!array.splice(index, 1);
}
+/**
+ * Mixin own properties of source
+ * object into the target.
+ *
+ * @param {Object} target
+ * @param {Object} source
+ */
+function mixin(target, source) {
+ for (var key in source) {
+ if (source.hasOwnProperty(key)) target[key] = source[key];
+ }
+}
+
// There should never be more than
// one instance of `FastDom` in an app
var exports = win.fastdom = (win.fastdom || new FastDom()); // jshint ignore:line