CocoonJS Extensions
The CocoonJS extensions are JavaScript APIs that provide further functionality on top of the HTML5 standard APIs. In order to use them, Ludei provides some .js files that should be included in your application. All the CocoonJS extensions are included inside the CocoonJS namespace. Each extension has it's own namespace upon the CocoonJS namespace. Although the APIs are easy to use, some general explanation on their structure could be useful:
- Extension files: All the extensions are provided in .js files. All the files start with the
CocoonJSprefix. There is a basic general purpose file calledCocoonJS.jsthat defines the basic namespace and should be included the first in your app. Each extension use a different suffix after an underscore '_'. For example, the general purpose extension is defined inside theCocoonJS_App.jsfile. There are some extensions that provide specific functionalities for CocoonJS and the WebView environments. In these cases, an additional suffix is used after another underscore. The extension functionalities for CocoonJS environment use theForCocoonJSsuffix and the extension functionalities for the WebView environment use theForWebViewsuffix. For example, the basic extensions functionalities just for the CocoonJS environment are stored in a file calledCocoonJS_App_ForCocoonJS.js(and a similar one calledCocoonJS_App_ForWebView.jsfor the WebView environment). Read the ''CocoonJS and the WebView'' section for more information.
- Data Structures: Some extension namespaces expose some data structures that are related to the extension use. Some of these structures are plain enumerations of possible values and others represent structures that will be passed to or from extension functions or extension events.
- Functions: The CocoonJS extensions expose a set a functions that provide the functionality.
- Event Objects/Handlers: The CocoonJS extensions use a event object mechanism in order to provide callback functionality for some events or asynchronous return of some function calls. All the CocoonJS event objects always follow the same structure. They are objects that represent the event handlers and all of them provide
addEventListener
and
removeEventListener
functions. A callback function with certain signature must be passed to these functions to register/unregister as listeners of the corresponding event.
Documentation
Please, refer to the documentation of each extension in order to get more information on the data structures, functions and event objects of each one.
All the functionalities related to the CocoonJS and WebView handling are documented in the CocoonJS Basic Extensions section.