Commit 1cb52dfb authored by Romain Courteaud's avatar Romain Courteaud

Update documentation

parent af44eae9
......@@ -4,4 +4,5 @@ Authors
* Francois Billioud
* Tristan Cavelier
* Sven Franck
* Romain Courteaud
......@@ -53,56 +53,7 @@ Create a constructor:
}
}
Create 9 methods: ``post``, ``put``, ``putAttachment``, ``get``, ``getAttachment``,
``remove``, ``removeAttachment``, ``allDocs``. ``repair`` method is optional.
.. code-block:: javascript
MyStorage.prototype.post = function(command, metadata, option) {
var document_id = metadata._id;
// [...]
};
MyStorage.prototype.get = function(command, param, option) {
var document_id = param._id;
// [...]
};
MyStorage.prototype.putAttachment = function(command, param, option) {
var document_id = param._id;
var attachment_id = param._attachment;
var attachment_data = param._blob;
// [...]
};
// [...]
(To help you design your methods, some tools are provided by jIO.util.)
The second parameter ``metadata`` or ``param`` is the first parameter provided by the jIO user.
The third parameter ``option`` is the option parameter provided by the jIO user.
Methods should return:
* **post()**, **put()**, **remove()** --> id of the document affected (string)
* **putAttachment()** or **removeAttachment()** --> no specific value
* **get()** --> document_metadata (object)
* **getAttachment()** -->
.. code-block:: javascript
new Blob([data], {"type": content_type})
* **allDocs()** --> list of all documents (restricted by a query, if given). (object)
After creating all methods, your storage must be added to jIO. This is done
Your storage must be added to jIO. This is done
with the ``jIO.addStorage()`` method, which requires two parameters: the storage
type (string) and a constructor (function). It is called like this:
......
......@@ -10,34 +10,12 @@ Getting started
.. code-block:: html
<!-- jio core + dependencies -->
<script src="sha256.amd.js"></script>
<script src="rsvp-custom.js"></script>
<script src="rsvp.js"></script>
<script src="jio.js"></script>
<!-- storages + dependencies -->
<script src="localstorage.js"></script>
<script src="davstorage.js"></script>
<script ...>
With `RequireJS <http://requirejs.org/>`_, the main.js should look like:
.. code-block:: javascript
require.config({
paths: {
// jio core + dependency
sha256: 'sha256.amd', // AMD-compatible version of sha256.js
rsvp: 'rsvp-custom',
jio: 'jio',
// storages + dependencies
localstorage: 'localstorage',
davstorage: 'davstorage'
}
});
#. jIO connects to a number of storages and allows adding handlers (or
functions) to specific storages.
You can use both handlers and available storages to build a storage
......@@ -90,65 +68,15 @@ Getting started
Download & Fork
---------------
Please note that the current (2.0.0-wip) version is not stable yet.
You can use one of the ZIP packages, which include all the dependencies and storages:
`Full download (172k) <_static/jio-2.0.0-wip.zip>`_
`Minified download (87k) <_static/jio-2.0.0-wip-min.zip>`_
or you can create your own set of files, which are are provided in the above packages and the source repository:
Core
^^^^
* sha256.amd.js
* rsvp-custom.js, AMD only version: rsvp-custom.amd.js
* jio.js
Storage dependencies
^^^^^^^^^^^^^^^^^^^^
.. XXX this is a little confusing.
* `jquery.js <http://code.jquery.com/jquery.js>`_
* `Stanford Javascript Crypto Library <http://bitwiseshiftleft.github.io/sjcl/>`_, `sjcl.zip <https://crypto.stanford.edu/sjcl/sjcl.zip>`_
* `pajhome.org.uk sha1 <http://pajhome.org.uk/crypt/md5/sha1.html>`_, AMD-compatible version: `sha1.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha1.amd.js>`_
* `anmar.eu.org jssha2 <http://anmar.eu.org/projects/jssha2/>`_, `jssha2.zip <http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip>`_, AMD-compatible versions: `sha2.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha2.amd.js>`_, `sha256.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha256.amd.js>`_
Storage connectors
^^^^^^^^^^^^^^^^^^
* Localstorage
* MemoryStorage
* IndexedDB
* WebSQL
* DavStorage
* Dropbox
* Google Drive
* ERP5Storage
* s3storage.js (WIP)
* xwikistorage.js (depends on jQuery) (WIP)
Storage handlers
^^^^^^^^^^^^^^^^
You can get latest jIO release by using on of those links:
* Zipstorage
* ShaStorage
* UUIDStorage
* QueryStorage
* CryptStorage
* UnionStorage
* FileSystemBridgeStorage
* Document Storage
* Replicate Storage
`Full download <https://lab.nexedi.com/nexedi/jio/raw/master/dist/jio-latest.js>`_
`Minified download <https://lab.nexedi.com/nexedi/jio/raw/master/dist/jio-latest.min.js>`_
Unit tests
^^^^^^^^^^
You can get latest RSVP release by using on of those links:
We monitor code quality with a `test agent <http://www.j-io.org/quality/unit_test>`_ that runs
the test suite with each release.
`Full download <https://lab.nexedi.com/nexedi/rsvp.js/raw/master/dist/rsvp-2.0.4.js>`_
`Minified download <https://lab.nexedi.com/nexedi/rsvp.js/raw/master/dist/rsvp-2.0.4.min.js>`_
Fork jIO
^^^^^^^^
......
......@@ -104,11 +104,11 @@ Promises
Each jIO method (with the exception of ``.createJIO()``) returns a Promise object, which allows us to get responses into
callback parameters and to chain callbacks with other returned values.
jIO uses a custom version of `RSVP.js <https://github.com/tildeio/rsvp.js>`_, adding canceler and progression features.
jIO uses a custom version of `RSVP.js <https://lab.nexedi.com/nexedi/rsvp.js>`_, adding canceler and progression features.
You can read more about promises:
* `RSVP.js <https://github.com/tildeio/rsvp.js#rsvpjs-->`_ on GitHub
* `RSVP.js <https://lab.nexedi.com/nexedi/rsvp.js>`_ on GitHub
* `Promises/A+ <http://promisesaplus.com/>`_
* `CommonJS Promises <http://wiki.commonjs.org/wiki/Promises>`_
......
......@@ -79,7 +79,7 @@ Example:
How to use Queries outside jIO?
-------------------------------
Refer to the `JIO Query sample page <http://git.erp5.org/gitweb/jio.git/blob/HEAD:/examples/example-queries.html?js=1>`_
Refer to the `JIO Query sample page <https://lab.nexedi.com/nexedi/jio/blob/master/examples/example-queries.html>`_
for how to use these methods, in and outside jIO. The module provides:
.. code-block:: javascript
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment