diff --git a/index.php b/index.php index f899243..3a47007 100644 --- a/index.php +++ b/index.php @@ -17,6 +17,7 @@ + @@ -108,6 +109,7 @@ @@ -145,7 +195,7 @@

Explore the Bitcoin's Blockchain

This is a drawing of the block of the Bitcoin's Blockchain.

- Click here to see the other blocks +
 

Click here to see the other blocks diff --git a/js/console.js b/js/console.js new file mode 100644 index 0000000..66196a3 --- /dev/null +++ b/js/console.js @@ -0,0 +1,27 @@ +/* + * Ce module fournit un log personnalisé + */ +topistoConsole = function(){ + + var _flag = true; + + function _log(texte) + { + if (_flag) console.log(texte); + return _flag; + }; + + function _on() + { + _flag = true; + return _flag; + }; + + function _off() + { + _flag = false; + return _flag; + }; + + return {log: _log, on: _on, off: _off}; +}(); diff --git a/js/lastblock.js b/js/lastblock.js index 84f82f6..74e963c 100644 --- a/js/lastblock.js +++ b/js/lastblock.js @@ -1,5 +1,8 @@ /* * Ce module permet d'écouter la blockchain + * Il maintient un tableau de hooks + * Il vérifie l'existence d'un nouveau block toutes les 30s + * Si un nouveau block est détecté, les hooks sont lancés un par un */ blockchainListener = function(){ @@ -23,8 +26,8 @@ blockchainListener = function(){ if (_isBlockNew(data)) { _last_block = data; - _last_block_hooks.forEach(function(element) { - element(data); + _last_block_hooks.forEach(function(trigger) { + trigger(data); }); } }, "json" );