-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function outside litedom #18
Comments
This is a general JavaScript question, but the function is in a different scope than the LiteDom instance. So, you would have to figure out a way to import the function into the LiteDom scope, or attach it to something global like |
Thanks for answering. Firstly how to create custom events that can be called outside litedom scope? Eg. https://tencent.github.io/omi/site/docs/index.html#/event?index=1&subIndex=2 |
@kethan if the function is defined outside of the JavaScript scope where the LiteDom instance is defined, you have to import it into the same scope as the LiteDom instance. Otherwise, a LiteDom instance cannot find the function. How is your code organized? |
Oh ok that means litedom can only call it's scope functions not the outside of it's scope. Then how can I use a litedom component in vue or angular for reusing? |
This is generally true in JavaScript, in that there is local and global scope: https://scotch.io/tutorials/understanding-scope-in-javascript If something is not defined in the global scope, meaning available everywhere, then it needs to be defined or imported into local scope. In order to import a LiteDom component into a Vue project, you would probably need to define it in its own file and export the LiteDom instance first. |
Oh nice thanks for the resources. |
Unable to dispatch custom event. |
Just define all of your JavaScript in the same |
Still not working. Can you check and let me know? |
The same similar code is working on other similar libraries |
In the fiddle you show, I get the following console error: TypeError: this.dispatchEvent is not a function I think |
If you can edit my code it will be very useful. Thanks |
Ques.2: Two-way data binding is not reflected on view on loading the page. |
For question 1, it would be good to have a semantically correct example from you, as part of due diligence. Perhaps just get a reference to the DOM item directly, rather than using properties of Please consider opening a second support request for question 2, here or on StackOverflow. |
how to call custom event outside litedom scope?
Eg.
<script> function a() { console.log('a') } </script><button @some-click="a()" class="button-outline">DOWN
The text was updated successfully, but these errors were encountered: