graphenejs-lib icon indicating copy to clipboard operation
graphenejs-lib copied to clipboard

Webpage example?

Open KrNel opened this issue 8 years ago • 0 comments

Hi,

Can you provide a simple example of converting the node.js code into a regular JS for use in a non-node.js website?

The code from the readme for example:

import {Apis} from "graphenejs-ws";
var {ChainStore} = require("graphenejs-lib");
Apis.instance("wss://bitshares.openledger.info/ws", true).init_promise.then((res) => {
    console.log("connected to:", res[0].network);
    ChainStore.init().then(() => {
        ChainStore.subscribe(updateState);
    });
});
let dynamicGlobal = null;
function updateState(object) {
    dynamicGlobal = ChainStore.getObject("2.1.0");
    console.log("ChainStore object update\n", dynamicGlobal ? dynamicGlobal.toJS() : dynamicGlobal);
}

In the steemjs-lib package you have listed some JS browser examples, and also there is an index.html in the examples folder, while the graphene lib you made does not.

I'm not a node user, and am just looking to get this working through regular web development.

Thank you for the assistance. Peace.

KrNel avatar Jan 16 '17 13:01 KrNel