Skip to content

Commit

Permalink
Fix @fileoverview comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Jun 19, 2020
1 parent 6703261 commit c9b2e34
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
9 changes: 3 additions & 6 deletions javascript/net/grpc/web/generictransportinterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
*
*/
/**
* @fileoverview gRPC web client Readable Stream
* @fileoverview gRPC-Web generic transport interface
*
* This class is being returned after a gRPC streaming call has been
* started. This class provides functionality for user to operates on
* the stream, e.g. set onData callback, etc.
*
* This wraps the underlying goog.net.streams.NodeReadableStream
* This class provides an abstraction for the underlying transport
* implementation underneath the ClientReadableStream layer.
*
* @author [email protected] (Stanley Cheung)
*/
Expand Down
30 changes: 29 additions & 1 deletion javascript/net/grpc/web/interceptor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/**
* @fileoverview grpc-web Interceptor.
* @fileoverview grpc-web client interceptors.
*
* The type of interceptors is determined by the response type of the RPC call.
* gRPC-Web has two generated clients for one service:
* FooServiceClient and FooServicePromiseClient. The response type of
* FooServiceClient is ClientReadableStream for BOTH unary calls and server
* streaming calls, so StreamInterceptor is expected to be used for intercepting
* FooServiceClient calls. The response type of PromiseClient is Promise, so use
* UnaryInterceptor for PromiseClients.
*/

goog.module('grpc.web.Interceptor');
Expand All @@ -11,6 +19,18 @@ const Request = goog.require('grpc.web.Request');
const UnaryResponse = goog.require('grpc.web.UnaryResponse');

/**
* Interceptor for RPC calls with response type `UnaryResponse`.
* An example implementation of UnaryInterceptor
* <pre>
* TestUnaryInterceptor.prototype.intercept = function(request, invoker) {
* const newRequest = ...
* return invoker(newRequest).then((response) => {
* // Do something with response.getMetadata
// Do something with response.getResponseMessage
* return response;
* });
* };
* </pre>
* @interface
*/
const UnaryInterceptor = function() {};
Expand All @@ -28,6 +48,14 @@ UnaryInterceptor.prototype.intercept = function(request, invoker) {};


/**
* Interceptor for RPC calls with response type `ClientReadableStream`.
*
* Two steps to create a stream interceptor:
* <1>Create a new subclass of ClientReadableStream that wraps around the
* original stream and overrides its methods. <2>Create a new subclass of
* StreamInterceptor. While implementing the
* StreamInterceptor.prototype.intercept method, return the wrapped
* ClientReadableStream.
* @interface
*/
const StreamInterceptor = function() {};
Expand Down

0 comments on commit c9b2e34

Please sign in to comment.