Call function of a javascript module
See original GitHub issueFirst, I would like congrats for that awesome project and documentation. Nice job!
I’m trying use django-unicorn
on a project and based on examples I guess that have many functions on JavaScript maybe cause conflicts.
There any possibility to call a javascript module function?
Example:
var Hellojs = (function() {
var self = {};
self.hello = function(name){
alert("Hello " + name)
}
return self;
}());
window.Hellojs = Hellojs;
class HelloView(UnicornView):
name = ""
def say_hello_in_js(self):
self.name = ""
self.call('Hellojs.hello', self.name)
Thanks, @adamghill and all contributors!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to call a function declared in a javascript module (type ...
First of all you have to explicitly export you function: export function greet() { alert("Hello from module"); }. Secondly, a module has ...
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >How do I call a javascript function inside a JS module ... - Reddit
Typically with JS modules you would export the function from one module and then import it into another module to call it: greetings.js:...
Read more >Modules, introduction - The Modern JavaScript Tutorial
A module may contain a class or a library of functions for a specific purpose. ... call functions of one module from another...
Read more >JavaScript Modules – Explained with Examples
A module is a function or group of similar functions. They are grouped together within a file and contain the code to execute...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://www.django-unicorn.com/docs/changelog/#v0-25-0 has been released with this fix! 🎉
Thanks @adamghill, I tried this PR, but I didn’t have enough time. I hope contribute more soon. This PR will help a lot.