Fix spacing on ws esmodule api example
This commit is contained in:
parent
19a86cbd59
commit
7014ac2335
@ -40,27 +40,27 @@ export const wsApiDocsData = {
|
|||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
esModule: `
|
esModule: `
|
||||||
const { %{0}: { websocket } } = mempoolJS();
|
const { %{0}: { websocket } } = mempoolJS();
|
||||||
|
|
||||||
const ws = websocket.initServer({
|
const ws = websocket.initServer({
|
||||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on("message", function incoming(data) {
|
ws.on("message", function incoming(data) {
|
||||||
const res = JSON.parse(data.toString());
|
const res = JSON.parse(data.toString());
|
||||||
if (res.block) {
|
if (res.block) {
|
||||||
console.log(res.block);
|
console.log(res.block);
|
||||||
}
|
}
|
||||||
if (res.mempoolInfo) {
|
if (res.mempoolInfo) {
|
||||||
console.log(res.mempoolInfo);
|
console.log(res.mempoolInfo);
|
||||||
}
|
}
|
||||||
if (res.transactions) {
|
if (res.transactions) {
|
||||||
console.log(res.transactions);
|
console.log(res.transactions);
|
||||||
}
|
}
|
||||||
if (res["mempool-blocks"]) {
|
if (res["mempool-blocks"]) {
|
||||||
console.log(res["mempool-blocks"]);
|
console.log(res["mempool-blocks"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
codeSampleMainnet: emptyCodeSample,
|
codeSampleMainnet: emptyCodeSample,
|
||||||
|
@ -152,6 +152,7 @@ export class CodeTemplateComponent implements OnInit {
|
|||||||
const init = async () => {
|
const init = async () => {
|
||||||
${codeText}
|
${codeText}
|
||||||
};
|
};
|
||||||
|
|
||||||
init();`;
|
init();`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user