From ba8ecce60766bd213f98f6156dcb3dd4feec2c14 Mon Sep 17 00:00:00 2001 From: manatlan Date: Fri, 26 Jan 2024 09:23:45 +0100 Subject: [PATCH] Update tag.py --- htag/tag.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htag/tag.py b/htag/tag.py index 11b924b..66cfe91 100644 --- a/htag/tag.py +++ b/htag/tag.py @@ -578,10 +578,14 @@ def _getAllJs(self) -> list: ll=[] # auto-declare js methods for exposed's python methods + autodeclares=[] for method_name in set(dir(self)) - TAG_KEYWORDS: if hasattr( getattr(self,method_name) ,"_autoExposeClientSide_"): logger.debug("expose python method '%s' as js caller in %s",method_name,repr(self)) - ll.append( "self.%s = function(_) {%s};" % (method_name,BaseCaller(self,method_name,[b"...arguments"],{})) ) + autodeclares.append( "self.%s = function(_) {%s}" % (method_name,BaseCaller(self,method_name,[b"...arguments"],{})) ) + + if autodeclares: + ll.append( self._genIIFEScript( ";".join(autodeclares) ) ) #IIFE ! if self.js: logger.debug("Init Script (.js) found in %s --> '%s'",repr(self),self.js)