Skip to content

Commit

Permalink
Expose MethodDescriptor's public methods (#1160)
Browse files Browse the repository at this point in the history
Co-authored-by: Eryu Xia <eryu@google.com>
  • Loading branch information
Cirillo Ferreira and sampajano committed Nov 19, 2021
1 parent cc1a135 commit 97baed4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 12 additions & 2 deletions javascript/net/grpc/web/methoddescriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,23 @@ const MethodDescriptor = class {

/**
* @override
* @export
*/
getName() {
return this.name;
}

/**
* @override
* @export
*/
getMethodType() {
return this.methodType;
}

/**
* @override
* @export
* @return {function(new: RESPONSE, ...)}
*/
getResponseMessageCtor() {
Expand All @@ -96,18 +99,25 @@ const MethodDescriptor = class {

/**
* @override
* @export
* @return {function(new: REQUEST, ...)}
*/
getRequestMessageCtor() {
return this.requestType;
}

/** @override */
/**
* @override
* @export
*/
getResponseDeserializeFn() {
return this.responseDeserializeFn;
}

/** @override */
/**
* @override
* @export
*/
getRequestSerializeFn() {
return this.requestSerializeFn;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/grpc-web/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ module.UnaryResponse.prototype.getResponseMessage = function() {};
module.UnaryResponse.prototype.getMetadata = function() {};
module.UnaryResponse.prototype.getMethodDescriptor = function() {};
module.UnaryResponse.prototype.getStatus = function() {};

module.MethodDescriptor = function() {};
module.MethodDescriptor.getName = function() {};
module.MethodDescriptor.getMethodType = function() {};
module.MethodDescriptor.getResponseMessageCtor = function() {};
module.MethodDescriptor.getRequestMessageCtor = function() {};
module.MethodDescriptor.getResponseDeserializeFn = function() {};
module.MethodDescriptor.getRequestSerializeFn = function() {};

0 comments on commit 97baed4

Please sign in to comment.