Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed May 27, 2016
1 parent 983ae44 commit 0a6f7df
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,27 @@

Binding to the *cordova* object available
[here](https://github.com/apache/cordova-js) in the src directory.
It allows you to create your cordova plugin entirely in OCaml by using the exec
function. You also have access to the device version, the platform id, etc.

## Introduction

### What's cordova ?

Cordova allows you to develop hybrid mobile application using web technologies such as HTML, CSS and Javascript. For more informations, see [the official website](https://cordova.apache.org/).
Through cordova plugins, you can access to the native components. To learn how to make cordova plugins, see [the official tutorial](https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html).
You can find the official cordova plugin list [here](https://cordova.apache.org/plugins/).

### Binding in OCaml to existing cordova plugins

There's a list of bindings to existing cordova plugins (written in Javascript)
using js_of_ocaml:
[See this
repository](https://github.com/dannywillems/ocaml-cordova-plugin-list).

## Develop your cordova plugin entirely in OCaml !

Instead of using js_of_ocaml to bind to existing cordova plugins, it's
interesting to be able to develop his own cordova plugin using only **ocaml**.

This repository aims to provide a simple way to do it by providing a binding to
the *cordova* object. You develop entirely in OCaml and this module will create,
using js_of_ocaml, the Javascript interface for your cordova plugin.
This binding provides you some functions to create easily listener for Cordova
like the deviceready event.

## Available bindings

* cordova.platformId
* cordova.platformVersion
* cordova.version
* Cordova.platform_id: get the platform id.
* Cordova.platform_version: get the platform version.
* Cordova.version: get the Cordova version.
* Cordova.Event: module for Cordva events.
* add_event_listener: add a listener on *volume buttons*, *deviceready*,
*backbutton*, etc. Use a sum type to have type checking.
* device_ready: alias to ```add_event_listener Device_ready```. **You need to
use it for all your Cordova projects using plugins because they are only
available when this event is handled**.

## How to install?

```Shell
opam install cordova
```

## Example

Expand Down

0 comments on commit 0a6f7df

Please sign in to comment.