Search code examples
cordovawinjscordova-plugins

Is it possible to create Windows cordova plugin with C#


When I look at cordova plugin, I see that all of the Windows (not phone) plugin developed with JS. How can a JS manage native operations without using any native code ?

Is there any possible way to develop plugin with C# or C++ ?


Solution

  • JavaScript is a native language on Windows and Windows Phone. On these platforms, all JS code in a Cordova app--plugin and app code alike--can call Windows APIs because the code is running in the native app host and not inside a Webview. (I talk about this in an MSDN article here: http://msdn.microsoft.com/en-us/magazine/dn879349.aspx). For this reason, there's no need to use another language for the plugin as happens on Android or iOS. That said, it might be possible to use C# or C++ for a plugin because it is true to write WinRT Components in those languages for use from a JS app, but I haven't tried that to know if it works or not. But you'd do this only if you needed the bit of increased performance from such code, not because you need access to native APIs, which can again be done from JS directly.