https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39567 --- Comment #19 from David Cook <dcook@prosentient.com.au> --- (In reply to Paul Derscheid from comment #16)
If we decided not to export the function, you could also just wrap it with (() => { <content of form-submit.js> })(); and have it as an IIFE rather than a module. Which would then also shorten the Asset.js call to: [% Asset.js("js/form-submit.js") | $raw %]
But that really depends on whether the exported function is in use outside of the context of form-submit.js itself. Maybe an IIFE is more fitting and can later be replaced by an exported function if the need arises?
That's also true. There's nothing about this code currently that necessarily requires the use of a module. We don't need to export the function, and we're not importing anything from a different module. I suppose the handy thing with the IIFE or the module is the scoping. With either option, we don't have to worry about the function "submit_form" conflicting with another function of the same name defined somewhere out there. I think both options are equal in this case. That said, I think you've already done all this work. I've just tweaked it to fit JS1. But since I've added a patch, I'll leave it to QA to determine what the best way to go is. -- You are receiving this mail because: You are watching all bug changes.