Is it possible to call a function in a lightning component from an external script?

Let's say I have a standalone lightning component on a page and I want to send it a message from another script is there a way to do that?


The answer is obvious in an event driven frame work. Creating an event that can be triggered by the script and having a handler in the component where you want to execute the action will do the trick. You trigger a lightning event from an external script as follows:

        var appEvent = $A.get("e.ns:myevt");
            message: "hello world"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.