cocoon-plugin-canvasplus-common

Common utils for Cocoon Canvas+

Usage no npm install needed!

<script type="module">
  import cocoonPluginCanvasplusCommon from 'https://cdn.skypack.dev/cocoon-plugin-canvasplus-common';
</script>

README

Cocoon Canvas+

Cocoon Canvas+ are multiplatform Javascript utilities that work in Canvas+. They are included in Canvas+ core, so it is not required to install anything else at the cloud. The required files, if so, will be injected automatically in your project. Only available in Cocoon.io projects.

deviceready event

The deviceready event fires when Cordova is fully loaded.

Unlike old CocoonJS plugins, Cocoon Canvas+ plugins need to wait for this event to start working.

Example

    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        // Cocoon Canvas+ code here
    }

You can learn more about Cordova events here

Canvas+ internal Webview

Canvas+ allows accessing a full DOM environment via Webview. Thus, there are two environments that live together: Canvas+ and WebView. Although both are two different JavaScript environments, Cocoon allows to render a transparent Webview on top of the Canvas+ OpenGL ES rendering context and it also provides a bidirectional communication channel between them. In this way, the final visual result seems to integrate both environments seamlessly.

However, as Cordova only injects automatically the required clobbers in the main webview engine, it is neccesary to add manually the following files to the content that will be sent and displayed in Canvas+ internal Webview:

Documentation

License

Mozilla Public License, version 2.0

Copyright (c) 2015 Ludei

See MPL 2.0 License