Merge pull request #2551 from hunicus/js-template-formatting
Fix spacing on websocket api examples
This commit is contained in:
		
						commit
						6235dc97a3
					
				@ -40,27 +40,27 @@ export const wsApiDocsData = {
 | 
			
		||||
        });
 | 
			
		||||
  `,
 | 
			
		||||
    esModule: `
 | 
			
		||||
const { %{0}: { websocket } } = mempoolJS();
 | 
			
		||||
  const { %{0}: { websocket } } = mempoolJS();
 | 
			
		||||
 | 
			
		||||
const ws = websocket.initServer({
 | 
			
		||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
 | 
			
		||||
});
 | 
			
		||||
  const ws = websocket.initServer({
 | 
			
		||||
    options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
ws.on("message", function incoming(data) {
 | 
			
		||||
const res = JSON.parse(data.toString());
 | 
			
		||||
if (res.block) {
 | 
			
		||||
console.log(res.block);
 | 
			
		||||
}
 | 
			
		||||
if (res.mempoolInfo) {
 | 
			
		||||
console.log(res.mempoolInfo);
 | 
			
		||||
}
 | 
			
		||||
if (res.transactions) {
 | 
			
		||||
console.log(res.transactions);
 | 
			
		||||
}
 | 
			
		||||
if (res["mempool-blocks"]) {
 | 
			
		||||
console.log(res["mempool-blocks"]);
 | 
			
		||||
}
 | 
			
		||||
});
 | 
			
		||||
  ws.on("message", function incoming(data) {
 | 
			
		||||
    const res = JSON.parse(data.toString());
 | 
			
		||||
    if (res.block) {
 | 
			
		||||
      console.log(res.block);
 | 
			
		||||
    }
 | 
			
		||||
    if (res.mempoolInfo) {
 | 
			
		||||
      console.log(res.mempoolInfo);
 | 
			
		||||
    }
 | 
			
		||||
    if (res.transactions) {
 | 
			
		||||
      console.log(res.transactions);
 | 
			
		||||
    }
 | 
			
		||||
    if (res["mempool-blocks"]) {
 | 
			
		||||
      console.log(res["mempool-blocks"]);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
    `,
 | 
			
		||||
  },
 | 
			
		||||
  codeSampleMainnet: emptyCodeSample,
 | 
			
		||||
 | 
			
		||||
@ -152,6 +152,7 @@ export class CodeTemplateComponent implements OnInit {
 | 
			
		||||
const init = async () => {
 | 
			
		||||
  ${codeText}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
init();`;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user