Comparing version 0.1.9 to 0.2.0
@@ -17,4 +17,2 @@ "use strict"; | ||
function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -25,3 +23,3 @@ | ||
var initConfig = { | ||
lifeCycle: ["awake", "start"] | ||
lifeCycle: ["_awake", "start"] | ||
}; | ||
@@ -56,5 +54,2 @@ | ||
var _lifeCycle = _toArray(lifeCycle), | ||
awake = _lifeCycle[0], | ||
lifeCycles = _lifeCycle.slice(1); | ||
@@ -73,14 +68,9 @@ components.forEach(function () { | ||
_context.t0 = cp[awake]; | ||
lifeCycle.forEach(function (key) { | ||
if (key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
}); | ||
if (!_context.t0) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 7; | ||
return cp[awake](); | ||
case 7: | ||
_context.next = 9; | ||
_context.next = 6; | ||
return Object.keys(cp).forEach(function (prop) { | ||
@@ -97,9 +87,11 @@ var hook = _[prop]; | ||
case 9: | ||
case 6: | ||
lifeCycles.forEach(function (key) { | ||
cp[key] && cp[key](); | ||
lifeCycle.forEach(function (key) { | ||
if (!key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
}); | ||
case 10: | ||
case 7: | ||
case "end": | ||
@@ -106,0 +98,0 @@ return _context.stop(); |
{ | ||
"name": "menhera", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"main": "dist", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -15,3 +15,3 @@ # Menhera | ||
name: "menhera-observer", | ||
awake() { | ||
_awake() { | ||
const { config: { observable = {} } } = _; | ||
@@ -47,3 +47,3 @@ _.Observer = { Event: new EventEmitter() }; | ||
name: "menhera-event", | ||
awake() { | ||
_awake() { | ||
_.Event = new EventEmitter(); | ||
@@ -67,3 +67,3 @@ _.onEvent = ({ name, event }) => { | ||
name: "test", | ||
awake() { | ||
_awake() { | ||
console.log("test0"); | ||
@@ -101,2 +101,3 @@ }, | ||
const _ = new Menhera({ | ||
lifeCycle: ["_awake", "start"], | ||
components: [Observer, Event, Test], | ||
@@ -103,0 +104,0 @@ observable: { test3: "test3" } |
11225
5
199
103