lundi 9 juillet 2018

JavaScript Module Pattern: user implementable function

So I'm using the Module pattern to create my own 'API' with private and public methods and properties. So far so good.

However: I want to add a public function/hook that can be changed/implemented by the user.

The problem however is that when the function is called from within the module it still knows the previous definition. How can I make sure to use the overridden definition without having to use the variable name within the module?

Aucun commentaire:

Enregistrer un commentaire