Setting variable from cordova plugin

I have created a separate js file for any cordova plugin functions and included it inside my index html file (page.html) Is this correct?

Do I need to import the swift file too?

Is this correct use of the function?

image