shouldFinishProcessingLoad Behavior flow - Minor changes
This commit is contained in:
parent
29c73f2ccc
commit
d647dc9d18
@ -148,12 +148,10 @@ import MVMCore
|
||||
|
||||
///Check with behavior if it can continue
|
||||
do{
|
||||
let conditionSatisfied = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in
|
||||
let allFinishedProcessingLoad = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in
|
||||
return try behavior.shouldFinishProcessingLoad(loadObject)
|
||||
}
|
||||
if conditionSatisfied == false {
|
||||
return conditionSatisfied
|
||||
}
|
||||
guard allFinishedProcessingLoad else { return false }
|
||||
} catch let behaviorError {
|
||||
if let errorObject = MVMCoreErrorObject.createErrorObject(for: behaviorError, location: MVMCoreLoadHandler.sharedGlobal()?.errorLocation(forRequest: loadObject)) {
|
||||
error.pointee = errorObject
|
||||
|
||||
@ -46,6 +46,6 @@ public extension PageBehaviorHandlerProtocol {
|
||||
}
|
||||
|
||||
func executeThrowingBehaviors<T>(_ behaviourBlock: (_ behavior: T) throws -> Bool) throws -> Bool {
|
||||
return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? false
|
||||
return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user