doc changes

This commit is contained in:
Fabian Vogelsteller 2016-11-01 16:24:54 +01:00
parent 54a56e770c
commit a0a8cfba41
No known key found for this signature in database
GPG Key ID: E51EADA77F1A4124
3 changed files with 33 additions and 7 deletions

View File

@ -5,18 +5,18 @@ Callbacks Promises Events
To help web3 integrate into all kind of projects with different standards
we provide multiple ways to act on asynchronous functions.
Most web3.js objects allow a callback as the last parameter, as well as return a promise to chain funcitons.
Most web3.js objects allow a callback as the last parameter, as well as returning promises to chain functions.
Ethereum as a blockchain has different level of finality and therefore we return for some functions,
like ``web3.eth.sendTransaction`` or contract methods a "promiEvent". This is a promise combined with an event emitter.
This promiEvent works like a normal promise with added ``on`` functions to watch for additional events like "receipt" or "transactionHash"
This promiEvent works like a normal promise with added ``on`` and ``once`` functions to watch for additional events like "receipt" or "transactionHash"
.. code-block:: javascript
web3.eth.sendTransaction({from: '0x123...', data: '0x432...'})
.on('transactionHash', function(hash){ ... })
.on('receipt', function(receipt){ ... })
.once('transactionHash', function(hash){ ... })
.once('receipt', function(receipt){ ... })
.then(function(receipt){
// will be fired once the receipt its mined
});

View File

@ -1,10 +1,10 @@
###############
========
web3.eth
###############
========
Some text
web3.version
**************
============
XYZ

26
docs/web3.rst Normal file
View File

@ -0,0 +1,26 @@
====
web3
====
The web3.js object is a container object to house all ethereum related modules.
web3.version
============
Contains the version of the web3.js container object.
-------
Returns
-------
``String`` - The version of the web3.js container object
-------
Example
-------
.. code-block:: javascript
web3.version;
> "1.0.0"