Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"gen-proto": "node scripts/gen-proto.js"
},
"dependencies": {
"google-protobuf": "^3.19.1",
"grpc-web": "^1.3.1",
"@volankey/grpc-web-invoker": "file:../../src/grpc-web-invoker",
"google-protobuf": "^3.19.1",
"grpc-web": "1.4.2",
"lodash-es": "^4.17.21",
"vue": "^3.2.16"
},
Expand All @@ -20,8 +20,8 @@
"@types/google-protobuf": "^3.15.5",
"@types/lodash-es": "^4.17.5",
"@vitejs/plugin-vue": "^1.9.3",
"typescript": "^4.4.3",
"@volankey/grpc-web-pb-transform": "file:../../src/grpc-web-pb-transform",
"typescript": "^4.4.3",
"vite": "^2.6.4",
"vue-tsc": "^0.3.0"
}
Expand Down
6 changes: 6 additions & 0 deletions example/frontend/scripts/gen-proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { exec } = require('child_process');
const {
pbValueTypeTransfer,
cjs2esm,
clientCompatibleGrpcWeb,
} = require('@volankey/grpc-web-pb-transform');
const { join } = require('path');
const startTime = Date.now();
Expand All @@ -18,6 +19,11 @@ exec(
return;
}
pbValueTypeTransfer(join(__dirname, '../src/proto/echo_pb.js'));
// if you use grpc-web 1.4.x, you need to use clientCompatibleGrpcWeb
// ref:https://github.com/grpc/grpc-web/releases/tag/1.4.0
clientCompatibleGrpcWeb(
join(__dirname, '../src/proto/EchoServiceClientPb.ts'),
);
// if you use vite, transform to esm
cjs2esm(
[
Expand Down
6 changes: 4 additions & 2 deletions example/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function doEcho(mockDelay?: number) {
{
cancelToken: cancelToken.token,
},
);
).catch((e) => {
console.error('error', e);
});

Promise.race([invokePromise, timeoutAbort])
.then((t) => {
Expand All @@ -65,7 +67,7 @@ function doEcho(mockDelay?: number) {
result.value = JSON.stringify(resp, null, ' ');
})
.catch((e) => {
console.error(e);
console.error('error', e);
})
.finally(() => {
sending.value = false;
Expand Down
Loading