Closures with multiple PRE and POST checking functions must be wrapped up in
objects like below for everything to be linked up in an orderly fashion. No
parameters are checked here, just logged to show the order of events.
function PRE_check_yourClosure(init){console.log('PRE closure-', init)}
function POST_check_yourClosure(result){console.log('POST closure-', result)}
function PRE_check_yourFunction(input){console.log('PRE function-', input)}
function POST_check_yourFunction(output){console.log('POST function-', output)}
PRE_checks_closure = {yourClosure:PRE_check_yourClosure,
yourFunction:PRE_check_yourFunction}
POST_checks_closure = {yourClosure:POST_check_yourClosure,
yourFunction:POST_check_yourFunction}
yourClosure = type_czech.linkUp(yourClosure,
PRE_checks_closure,
POST_checks_closure)
function yourClosure(init_closure){
yourFunction = function(function_input){
return init_closure + ' ' + function_input
}
return {yourFunction}
}
a_closure = yourClosure('hi')
a_closure.yourFunction('there')
>> PRE closure- hi
>> POST closure- Object { yourFunction: Proxy }
>> PRE function- there
>> POST function- hi there
>> "hi there"