Skip to content

Commit

Permalink
Other: Statically generated services actually inherit from rpc.Service
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 20, 2017
1 parent 6ba8c72 commit 7299929
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 74 deletions.
21 changes: 7 additions & 14 deletions cli/targets/static.js
Expand Up @@ -550,22 +550,15 @@ function buildService(ref, service) {
"Constructs a new " + service.name + " service.",
service.comment ? "@classdesc " + service.comment : null,
"@exports " + fullName,
"@extends $protobuf.util.EventEmitter",
"@extends $protobuf.rpc.Service",
"@constructor",
"@param {RPCImpl} rpc RPC implementation",
"@param {RPCImpl} rpcImpl RPC implementation",
"@param {boolean} [requestDelimited=false] Whether requests are length-delimited",
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited",
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited"
]);
push("function " + name(service.name) + "(rpc, requestDelimited, responseDelimited) {");
push("function " + name(service.name) + "(rpcImpl, requestDelimited, responseDelimited) {");
++indent;
push("$util.EventEmitter.call(this);");

push("");
pushComment([
"RPC implementation.",
"@type {RPCImpl}"
]);
push("this.rpc = rpc;");
push("$protobuf.rpc.Service.call(this, rpcImpl);");
push("");
pushComment([
"Whether requests are length-delimited.",
Expand All @@ -581,12 +574,12 @@ function buildService(ref, service) {
--indent;
push("}");
push("");
push("(" + name(service.name) + ".prototype = Object.create($util.EventEmitter.prototype)).constructor = " + name(service.name) + ";");
push("(" + name(service.name) + ".prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = " + name(service.name) + ";");

if (config.create) {
push("");
pushComment([
"Creates a runtime service using the specified rpc implementation.",
"Creates new " + service.name + " service using the specified rpc implementation.",
"@param {RPCImpl} rpcImpl RPC implementation",
"@param {boolean} [requestDelimited=false] Whether requests are length-delimited",
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited",
Expand Down
12 changes: 6 additions & 6 deletions dist/light/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/light/protobuf.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/light/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/light/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/light/protobuf.min.js.map

Large diffs are not rendered by default.

122 changes: 103 additions & 19 deletions dist/minimal/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/minimal/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/minimal/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/minimal/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/minimal/protobuf.min.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -32,7 +32,7 @@
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js tests/node/*.js",
"coverage-ci": "npm run coverage && cat coverage/lcov.info | coveralls",
"docs": "jsdoc -c jsdoc.docs.json -R README.md",
"lint": "eslint src light minimal",
"lint": "eslint src",
"pages": "node scripts/pages",
"prepublish": "node scripts/prepublish",
"postinstall": "node scripts/postinstall",
Expand Down
5 changes: 5 additions & 0 deletions scripts/gentests.js
Expand Up @@ -26,6 +26,11 @@ var fs = require("fs"),
var pathToProtobufjs = path.relative(path.dirname(out), "minimal").replace(/\\/g, "/");
fs.writeFileSync(out, fs.readFileSync(out).toString("utf8").replace(/"protobufjs\/minimal"/g, JSON.stringify(pathToProtobufjs)), "utf8");
process.stdout.write("pbjs: " + file + " -> " + out + "\n");
try {
require(path.join(__dirname, "..", out));
} catch (err2) {
process.stderr.write("ERROR: " + err2.message + "\n");
}
})
});

Expand Down

0 comments on commit 7299929

Please sign in to comment.