Skip to content

Commit 7299929

Browse files
committed
Other: Statically generated services actually inherit from rpc.Service
1 parent 6ba8c72 commit 7299929

22 files changed

+150
-74
lines changed

cli/targets/static.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -550,22 +550,15 @@ function buildService(ref, service) {
550550
"Constructs a new " + service.name + " service.",
551551
service.comment ? "@classdesc " + service.comment : null,
552552
"@exports " + fullName,
553-
"@extends $protobuf.util.EventEmitter",
553+
"@extends $protobuf.rpc.Service",
554554
"@constructor",
555-
"@param {RPCImpl} rpc RPC implementation",
555+
"@param {RPCImpl} rpcImpl RPC implementation",
556556
"@param {boolean} [requestDelimited=false] Whether requests are length-delimited",
557-
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited",
557+
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited"
558558
]);
559-
push("function " + name(service.name) + "(rpc, requestDelimited, responseDelimited) {");
559+
push("function " + name(service.name) + "(rpcImpl, requestDelimited, responseDelimited) {");
560560
++indent;
561-
push("$util.EventEmitter.call(this);");
562-
563-
push("");
564-
pushComment([
565-
"RPC implementation.",
566-
"@type {RPCImpl}"
567-
]);
568-
push("this.rpc = rpc;");
561+
push("$protobuf.rpc.Service.call(this, rpcImpl);");
569562
push("");
570563
pushComment([
571564
"Whether requests are length-delimited.",
@@ -581,12 +574,12 @@ function buildService(ref, service) {
581574
--indent;
582575
push("}");
583576
push("");
584-
push("(" + name(service.name) + ".prototype = Object.create($util.EventEmitter.prototype)).constructor = " + name(service.name) + ";");
577+
push("(" + name(service.name) + ".prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = " + name(service.name) + ";");
585578

586579
if (config.create) {
587580
push("");
588581
pushComment([
589-
"Creates a runtime service using the specified rpc implementation.",
582+
"Creates new " + service.name + " service using the specified rpc implementation.",
590583
"@param {RPCImpl} rpcImpl RPC implementation",
591584
"@param {boolean} [requestDelimited=false] Whether requests are length-delimited",
592585
"@param {boolean} [responseDelimited=false] Whether responses are length-delimited",

dist/light/protobuf.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/light/protobuf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/light/protobuf.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/light/protobuf.min.js.gz

6 Bytes
Binary file not shown.

dist/light/protobuf.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/minimal/protobuf.js

Lines changed: 103 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/minimal/protobuf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/minimal/protobuf.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/minimal/protobuf.min.js.gz

100 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)