From 361a172d33d04889c1315c3056830701c7bf8eb8 Mon Sep 17 00:00:00 2001 From: adcpm <fabien@bonustrack.co> Date: Fri, 2 Jun 2017 14:51:56 +0700 Subject: [PATCH] Add comment operation example --- examples/broadcast.html | 42 +++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/examples/broadcast.html b/examples/broadcast.html index 7033eac..9c6a8d5 100644 --- a/examples/broadcast.html +++ b/examples/broadcast.html @@ -8,16 +8,38 @@ <script src="../dist/steem.min.js"></script> <script> -steem.broadcast.vote( - '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg', // Posting WIF - 'guest123', // Voter username - 'firepower', // Author - 'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians', // Permlink - 10000, // Weight (10000 = 100%) - function(err, result) { - console.log(err, result); - } -); + /** Configure your account */ + var username = 'guest123'; + var postingWif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg'; + + /** Broadcast a vote */ + steem.broadcast.vote( + postingWif, + username, // Voter + 'firepower', // Author + 'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians', // Permlink + 10000, // Weight (10000 = 100%) + function(err, result) { + console.log(err, result); + } + ); + + /** Broadcast a comment */ + var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase(); + + steem.broadcast.comment( + postingWif, + 'siol', // Parent Author + 'test', // Parent Permlink + username, // Author + permlink, // Permlink + '', // Title + 'This is a test!', // Body, + { tags: ['test'], app: `steemjs/examples` }, // Json Metadata + function(err, result) { + console.log(err, result); + } + ); </script> </body> -- GitLab