cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ged Wed <>
Subject golang based plugins
Date Thu, 29 Dec 2016 21:17:45 GMT
I am considered writing plugins  in golang ?
I dont know enough about the internals of Cordova to estimate some of the
work involved, and am looking for any feedback from others before writing

The nature of the plugin API being so simple makes it very easy to be
supported on obth Mobile and desktop.

cordova.exec(function(winParam) {},
             function(error) {},
             ["firstArgument", "secondArgument", 42, false]);

All that is needed is a pass through layer be written for IOS and android
once, and never again.
Once the pass through layr is written, all golang developers just write
their plugins in golang.
For Android a standard java layer passes the cordova.exec call to the
golang binding.
For IOS, its exactly same. an Objective C layer, that simple passes the
cordova.exe call to the golang binding.

At the golang level you just need to implement the same interface as cordova
Then the golang code  just does a switch on the Service and Action, and
retusn the result.
At this level you can use any golang embedded database (indexdb, bolt, etc)
and any golang code pretty much.

For the golang developer, compiling on mobile is always "gomobile build
--target=android", which produces an android gradle project
For IOS, its "gomobile build --target=ios", which produce a Framework

For Desktop, its exactyl the same approach as for Mobile.

Please let me knwo your thoughts

thanks in advance ..


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message