HeadsetDetection-PhoneGap-Plugin icon indicating copy to clipboard operation
HeadsetDetection-PhoneGap-Plugin copied to clipboard

NativeScript port

Open scamianbas opened this issue 8 years ago • 7 comments

Hi Eddy, I was wondering how hard is it to port this cordova plugin to a nativescript module ? Do I have to know the Android and IOS developer API reference ? Thanks,

scamianbas avatar Jan 12 '17 10:01 scamianbas

It would be one of the easiest plugins. Just translate the Java and ObjC code to TypeScript (or plain JavaScript if that's your thing). Are you pondering doing it yourself?

EddyVerbruggen avatar Jan 12 '17 15:01 EddyVerbruggen

Hi Eddy, I would like to but it's not clear for me in the NativeScript docs how each Java/ObjC statement translates to its javascript equivalent ... Could you help to get me started ? Thanks!

scamianbas avatar Jan 18 '17 08:01 scamianbas

Perhaps it's best to look at how any other plugin does that. I can recommend one, but it depends on if you'd like to use JavaScript or TypeScript to create the plugin.

EddyVerbruggen avatar Jan 18 '17 10:01 EddyVerbruggen

I have a preference for plain old JavaScript.

scamianbas avatar Jan 18 '17 10:01 scamianbas

Then this repo may be a good one to clone. It's loosely based on native code available in this plugin so you should be able to see how to translate between native and JS.

There's also some good pointers here.

EddyVerbruggen avatar Jan 18 '17 10:01 EddyVerbruggen

Thanks Eddy, I'll check that asap.

scamianbas avatar Jan 18 '17 13:01 scamianbas

Hi Eddy, would it be possible to send a typescript example??? thanks, mate.

kieranthompson avatar Nov 25 '17 13:11 kieranthompson