import Block from "../components/block" ; import StructureCollection from "../components/structure-collection" ; export const nextTick = ( func ) => { Promise . resolve ( ) . then ( func ) ; } ; export const walkTree = ( structureCollection , callback ) => { if ( callback ( structureCollection ) ) { return true ; } for ( let i = 0 , len = structureCollection . getSize ( ) ; i < len ; i ++ ) { let each = structureCollection . getChild ( i ) ; if ( each instanceof StructureCollection ) { if ( walkTree ( each , callback ) ) { return true ; } } if ( callback ( each ) ) { return true ; } } return false ; } ; export const createError = ( message , block ? , type ? ) => { let error = new Error ( message ) ; error . type = type || "component" ; error . blockInfo = block ; return error ; } ;