EddyVerbruggen / HeadsetDetection-PhoneGap-Plugin

:headphones: A PhoneGap plugin for detection of a headset (wired or bluetooth)
34 stars 26 forks source link

NativeScript port #7

Open scamianbas opened 7 years ago

scamianbas commented 7 years ago

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,

EddyVerbruggen commented 7 years ago

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?

scamianbas commented 7 years ago

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!

EddyVerbruggen commented 7 years ago

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.

scamianbas commented 7 years ago

I have a preference for plain old JavaScript.

EddyVerbruggen commented 7 years ago

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.

scamianbas commented 7 years ago

Thanks Eddy, I'll check that asap.

kieranthompson commented 6 years ago

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