-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
410 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
miniprogram/project.private.config.json | ||
miniprogram/generated_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// app.js | ||
App({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"pages": ["pages/index/index"], | ||
"window": { | ||
"navigationBarTextStyle": "black", | ||
"navigationStyle": "custom" | ||
}, | ||
"style": "v2", | ||
"renderer": "skyline", | ||
"rendererOptions": { | ||
"skyline": { | ||
"defaultDisplayBlock": true, | ||
"disableABTest": true, | ||
"sdkVersionBegin": "3.0.0", | ||
"sdkVersionEnd": "15.255.255" | ||
} | ||
}, | ||
"componentFramework": "glass-easel", | ||
"lazyCodeLoading": "requiredComponents" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/**app.wxss**/ | ||
.container { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 200rpx 0; | ||
box-sizing: border-box; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Page({ | ||
onReady: () => { | ||
require.async('../../generated_modules/connect-client').then(({ main }) => { | ||
main(); | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!--index.wxml--> | ||
<scroll-view class="scrollarea" scroll-y type="list"> | ||
<view class="container"> | ||
Weixin | ||
</view> | ||
</scroll-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/**index.wxss**/ | ||
page { | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.scrollarea { | ||
flex: 1; | ||
overflow-y: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"appid": "wx043e0b542b3515b8", | ||
"compileType": "miniprogram", | ||
"libVersion": "3.1.5", | ||
"packOptions": { | ||
"ignore": [], | ||
"include": [] | ||
}, | ||
"setting": { | ||
"urlCheck": false, | ||
"coverView": true, | ||
"es6": true, | ||
"postcss": true, | ||
"minified": true, | ||
"enhance": true, | ||
"showShadowRootInWxmlPanel": true, | ||
"packNpmRelationList": [], | ||
"babelSetting": { | ||
"ignore": [], | ||
"disablePlugins": [], | ||
"outputPath": "" | ||
} | ||
}, | ||
"condition": {}, | ||
"editorSetting": { | ||
"tabIndent": "insertSpaces", | ||
"tabSize": 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "example-mina", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "esbuild src/connect-client.js --bundle --outfile=miniprogram/generated_modules/connect-client.js --format=cjs --target=es2015 --inject:src/polyfill.js" | ||
}, | ||
"dependencies": { | ||
"@buf/connectrpc_eliza.connectrpc_es": "^1.1.3-20230913231627-233fca715f49.1", | ||
"@bufbuild/protobuf": "^1.4.1", | ||
"@connectrpc/connect": "^1.1.3", | ||
"connect-miniprogram": "workspace:packages/connect-miniprogram" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.19.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createPromiseClient } from '@connectrpc/connect'; | ||
import { | ||
createConnectTransport, | ||
createGrpcWebTransport, | ||
} from 'connect-miniprogram/src'; | ||
import { ElizaService } from '@buf/connectrpc_eliza.connectrpc_es/connectrpc/eliza/v1/eliza_connect'; | ||
|
||
export const isDevTool = wx.getSystemInfoSync().platform === 'devtools'; | ||
|
||
export const baseUrl = 'https://demo.connectrpc.com'; | ||
|
||
const grpcTransport = createGrpcWebTransport({ | ||
baseUrl, | ||
request: wx.request, | ||
isDevTool, | ||
}); | ||
|
||
const grpcClient = createPromiseClient(ElizaService, grpcTransport); | ||
|
||
const connectTransport = createConnectTransport({ | ||
baseUrl, | ||
request: wx.request, | ||
isDevTool, | ||
}); | ||
|
||
const connectClient = createPromiseClient(ElizaService, connectTransport); | ||
|
||
export async function main() { | ||
connectClient | ||
.say({ | ||
sentence: 'I feel happy.', | ||
}) | ||
.then((res) => { | ||
console.log('[connect.say]', res); | ||
}); | ||
|
||
for await (const res of connectClient.introduce({ name: 'Joseph' })) { | ||
console.log('[connect.introduce]', res); | ||
} | ||
|
||
grpcClient | ||
.say({ | ||
sentence: 'I feel happy.', | ||
}) | ||
.then((res) => { | ||
console.log('[grpc.say]', res); | ||
}); | ||
|
||
for await (const res of grpcClient.introduce({ name: 'Joseph' })) { | ||
console.log('[grpc.introduce]', res); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { | ||
HeadersPolyfill, | ||
FastTextDecoder, | ||
FastTextEncoder, | ||
} from 'connect-miniprogram/polyfill'; | ||
|
||
export { | ||
HeadersPolyfill as Headers, | ||
FastTextDecoder as TextDecoder, | ||
FastTextEncoder as TextEncoder, | ||
}; |
Oops, something went wrong.