mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
doc changes
This commit is contained in:
parent
54a56e770c
commit
a0a8cfba41
@ -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
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
###############
|
||||
========
|
||||
web3.eth
|
||||
###############
|
||||
========
|
||||
|
||||
Some text
|
||||
|
||||
web3.version
|
||||
**************
|
||||
============
|
||||
|
||||
XYZ
|
||||
|
26
docs/web3.rst
Normal file
26
docs/web3.rst
Normal 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"
|
Loading…
x
Reference in New Issue
Block a user