Snímky obrazovky

Popis

grpc, proto, protobufjs, devtools, chrome, extensions ### use 1, Use node and protobufjs to create proto.js. ``` javascript const pbjs = require("protobufjs/cli/pbjs"); const fs = require('fs'); const path = require('path'); const glob = require('glob'); const protoPath = 'src/proto/**/*.proto'; // origin path const protos = glob.sync(protoPath); pbjs.main([ "--target", "json-module", "-w", "commonjs", ...protos], function(err, output) { if (err) throw err; // target path fs.writeFileSync(path.resolve(__dirname, './src/xxx/proto.js'), output); }); ``` 2, Attach the JSON string to window. ``` javascript const $root = require('./src/xxx/proto.js'); window.__DEVTOOLS_PROTO_JSON_STRING__ = JSON.stringify($root.toJSON({keepComments: true})); ```