@@ -38,7 +38,11 @@ export default ({ Superclass }) => {
3838 // get callback from subtrees
3939 if ( this . insertionPoint ) {
4040 for ( let insertionPoint of this . insertionPoint ) {
41- let subsequentArray = await this . initializeInsertionPoint ( { insertionPoint } )
41+ let children = await this . filterChildrenOfCurrentInsertionPoint ( {
42+ insertionPointKey : insertionPoint . key ,
43+ children : this . children
44+ } )
45+ let subsequentArray = await this . initializeInsertionPoint ( { insertionPoint, children } )
4246 if ( array . length != 0 ) {
4347 await Array . prototype . push . apply ( array , subsequentArray )
4448 } else {
@@ -49,25 +53,21 @@ export default ({ Superclass }) => {
4953 return array ;
5054 }
5155
52- async initializeInsertionPoint ( { insertionPoint} ) {
53- // [1] get children immediate & relating to this insertion position.
54- let filteredChildren = this . children . filter ( object => { // filter children that correspont to the current insertionpoint.
55- return ( object . insertionPosition . insertionPoint == insertionPoint . key && object . insertionPosition . insertionPathPointer == null )
56- } )
56+ async initializeInsertionPoint ( { insertionPoint, children } ) {
5757 // [2] check type of subtrees execution: race first, all ... .
58- let executionTypeCallbackName ;
59- switch ( insertionPoint . executionType ) {
58+ let callback ;
59+ switch ( insertionPoint . executionType ) { // execution type callback name
6060 case 'chronological' :
61- executionTypeCallbackName = 'initializeTreeInChronologicalSequence'
61+ callback = 'initializeTreeInChronologicalSequence'
6262 break ;
6363 case 'middlewareArray' :
64- executionTypeCallbackName = 'returnMiddlewareArray'
64+ callback = 'returnMiddlewareArray'
6565 break ;
6666 default :
6767 console . log ( `"${ insertionPoint . executionType } " executionType doesn\'t match any kind.` )
6868 }
6969 // [3] call handler on them.
70- return await this [ executionTypeCallbackName ] ( filteredChildren )
70+ return await this [ callback ] ( children )
7171 }
7272
7373 async initializeTreeInChronologicalSequence ( treeChildren ) {
0 commit comments