Classes with multiple PRE and POST checking functions must be wrapped up in
objects like below for everything to be linked up.
function PRE_check_yourClass(init){console.log('PRE class-', init)}
function POST_check_yourClass(result){console.log('POST class-', result)}
function PRE_check_yourMethod(input){console.log('PRE method-', input)}
function POST_check_yourMethod(output){console.log('POST method-', output)}
PRE_checks_class = { yourClass:PRE_check_yourClass,
yourMethod:PRE_check_yourMethod }
POST_check_class = { yourClass:POST_check_yourClass,
yourMethod:POST_check_yourMethod }
class yourClass {
constructor(init_class){ this.init_class = init_class}
yourMethod(method_input){
return this.init_class + ' ' + method_input
}
}
yourClass = type_czech.linkUp(yourClass, PRE_checks_class, POST_check_class)
a_class = new yourClass('hello')
a_class.yourMethod('again')
>> PRE class- hello
>> POST class- Object { init_class: "hello", yourMethod: Proxy }
>> PRE method- again
>> POST method- hello again
>> "hello again"
Note that the type_czech.linkUp() call must come after the class declaration, otherwise
you get the below ReferenceError, because classes do not hoist functions.
can't access lexical declaration 'yourClass' before initialization