I have a shared object named myModule contains many common-used functions:
myModule
alert: {showAlert: ƒ}
upload: ƒ (e)
uuid: {createUuid: ƒ}
__proto__: Object
- Function maybe child or great-grandchild of myModule
- These functions maybe loaded separately by multiple calls into a page
Now myModule maybe used in different script block in one page.
<script>
// loaded uuid, alert to myModule
</script>
<div> ... </div>
<script>
myModule.alert.showAlert(s);
</script>
<div> ... </div>
<script>
// loaded upload to my Module
</script>
<div> ... </div>
<script>
myModule.upload(f);
</script>
Now I wanna put logging at the beginning of each function of myModule. myModule is owned by my team(in different packages), I do want a way to do it with minimal change to these functions for there're so many functions. Is AOP the good choice? Or any way to make it simple?