New CocoonJS Plugins are here!

We have been working hard on improving the CocoonJS plugins. The new plugins for CocoonJS are finally ready and we have been focused on making them easier to handle. By the way, we have also revamped and improved the documentation with more examples and useful links.



To begin with, the main namespace for all the plugins has changed from CocoonJS to just Cocoon. Secondly, there is a new namespace organization and some plugin functionalities that before were included inside the App namespace, are now distributed among them. This is a more detailed list of the new namespaces:

  • Cocoon.Camera: It represents the CocoonJS camera plugin API.
  • Cocoon.Device: All functions related to the device.
  • Cocoon.Dialog: Dialog functions (prompt / confirm).
  • Cocoon.Motion: All functions related to the Accelerometer and Gyroscope.
  • Cocoon.Proxify: It proxies different functions of the WebView environment, like Audio objects and XHR.
  • Cocoon.Touch: It holds some functions to handle the touch events in both surfaces (Cocoon & WebView).
  • Cocoon.Widget: It holds the WebDialog widget, which essentially shows a Webview on top of the CocoonJS layer.
  • Cocoon.Utils: It holds some different utilities.

Additionally, note that Construct 2 plugin will be updated in order to use these new plugins.

Another important change from the old extensions is the new event handling system, based on signal events.

Below there are several examples about how to use the new plugins:

[code lang=”javascript”]
success : function(stream){
ctx.fillRect(0, 0, w, h);
ctx.drawImage(stream, 0, 0, w, h);
error : function(){
console.log(“Error”, arguments);
[code lang=”javascript”]
var dialog = new Cocoon.Widget.WebDialog();“”);
//This dialog will close after 15 seconds.
}, 15000);
Cocoon.App: On application suspended event.
[code lang=”javascript”]
Cocoon.App.on(“suspended”, function(){
console.log(“The application has been suspended”);

The new CocoonJS Plugins can be found at Github and, in order to improve them faster and to receive important feedback from our users, everyone can contribute to a better documentation by doing a pull request.

The new CocoonJS Plugins are published in beta and the old ones are in a deprecated state. Consequently, we will stop developing them.

We really hope you will benefit from this new structure of the plugins and the improved documentation.

6 Comments New CocoonJS Plugins are here!

  1. avatarMat Nicholas

    Will you be adding the following to the C2 plugin?

    -Facebook / Twitter
    -Game Center / Google Play Games Service
    -Local notifications

    1. avatarMarta Aguilera

      We already support Google Play Games and Game Center.
      If you check the plugin, you will see they are there:
      Apart from that, we have already said we will add Facebook in the following weeks and that we will consider also the rest features you mentioned.

      Anyway, remember that the Plugin is Open Source, so you can contribute with a pull request adding those features you miss.


      1. avatarMat Nicholas

        ok, thanks for the information. If I could add the features to the opensource plugin I would. Many users use C2 as an alternative to programming.

  2. avatarDrew Langford

    I cannot seem to get the google play services to work. I even compiled the demo.capx and the debug.apk won’t load on any of my devices. Other than that, I have had no issues with the new plugin! Loving it, just hope I can figure out how to use the google play services, the demo.apk doesn’t explain enough for a noob like me! Good Work guys!


Leave a Reply

Your email address will not be published. Required fields are marked *