Skip to content

Commit

Permalink
Merge pull request #62 from arestov/power-stack
Browse files Browse the repository at this point in the history
Power stack
  • Loading branch information
arestov committed Oct 21, 2019
2 parents 2287b8c + 1d2ee14 commit cc233ef
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
8 changes: 8 additions & 0 deletions js/libs/provoda/Model/postInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ function connectNests(self) {
initNestCompx(self);
}

function markInitied(md) {
// - this state shuld be true when all preparations, all initial triggers and subscribtions are done
// - use it to not produce effects for states changes during initialization
md.updateState('$meta_inited', true);
}

return function postInitModel(self) {
connectStates(self)
connectNests(self)
Expand All @@ -46,5 +52,7 @@ return function postInitModel(self) {
}

initApis(self)

self.nextTick(markInitied, null, false, self.current_motivator);
}
})
14 changes: 1 addition & 13 deletions js/libs/provoda/provoda.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var initDeclaredNestings = require('./initDeclaredNestings');
var markStrucure = require('./structure/mark');
var create = require('./create');
var addSubpage = require('./dcl/sub_pager/addSubpage');
var behavior = require('./provoda/bhv')
var mergeBhv = require('./mergeBhv');

var provoda, pv;
Expand Down Expand Up @@ -110,19 +111,6 @@ pv = provoda = {
mergeBhv: mergeBhv,
};

function behavior(declr, declr_extend_from, named) {
var behaviorFrom = declr_extend_from || pv.Model;
if (typeof named == 'object' || !declr.init) {
return spv.inh(behaviorFrom, {
naming: named && named.naming,
init: named && named.init,
props: declr
});
}
var func = named || function() {};
behaviorFrom.extendTo(func, declr);
return func;
}

function getHModel() {
var HModel = spv.inh(Model, {
Expand Down
19 changes: 19 additions & 0 deletions js/libs/provoda/provoda/bhv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
define(function(require) {
'use strict';
var spv = require('spv');
var Model = require('../Model');

return function behavior(declr, declr_extend_from, named) {
var behaviorFrom = declr_extend_from || Model;
if (typeof named == 'object' || !declr.init) {
return spv.inh(behaviorFrom, {
naming: named && named.naming,
init: named && named.init,
props: declr
});
}
var func = named || function() {};
behaviorFrom.extendTo(func, declr);
return func;
}
})
3 changes: 2 additions & 1 deletion js/utils/initApp.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
define(require => {
const pv = require('pv')

const glo = typeof global !== 'undefined' ? global : this
const initApp = (App, env) => {
const views_proxies = new pv.views_proxies.Proxies()
const sync_sender = new pv.SyncSender()
const flow = new pv.CallbacksFlow(global)
const flow = new pv.CallbacksFlow(glo)
return new Promise(resolve => {
flow.input(() => {
const app_model = new App({
Expand Down

0 comments on commit cc233ef

Please sign in to comment.