You need to sign in to do that
Don't have an account?

How to share Javascript object between functions inside a client controller in Lightning?
Hi all,
I'm trying to integrate a 3rd party Javascript library in my Lightning application.
This one if you are curious:
https://github.com/szimek/signature_pad
I can include the libray and initialize it with no problem but the problem arrises when you try to access the Javascript object through a different client side method.
EX:
I need "signaturePad" to be accessible from all my Client-side controller methods.
Is there a way to have a globally accessible var?
Cheers,
Laurent
I'm trying to integrate a 3rd party Javascript library in my Lightning application.
This one if you are curious:
https://github.com/szimek/signature_pad
I can include the libray and initialize it with no problem but the problem arrises when you try to access the Javascript object through a different client side method.
EX:
({ initSignature: function(component, event, helper) { console.log('init'); var canvas = component.find("signCanvas").getElement(); var signaturePad = new SignaturePad(canvas); }, saveSignature: function(component, event, helper) { console.log('save'); signaturePad.toDataURL() }, })
I need "signaturePad" to be accessible from all my Client-side controller methods.
Is there a way to have a globally accessible var?
Cheers,
Laurent
https://github.com/JohnBrunswick/Lightning-Ideas-Experiment
The trick was to store the Javascript object as a View Attribute of type Object.