@cpzxrobot/sdk 1.1.41 → 1.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -0
- package/index.ts +17 -0
- package/package.json +1 -1
- package/readme.md +1 -0
- package/types.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -127,6 +127,8 @@ class Cpzxrobot {
|
|
|
127
127
|
// @ts-ignore
|
|
128
128
|
this.vibrate = window.miniapp.vibrate;
|
|
129
129
|
this.saveBlob = this._saveBlobAsBase64;
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
this.getGeo = window.miniapp.getGeo;
|
|
130
132
|
}
|
|
131
133
|
else if (domain == "appassets.androidplatform.net" ||
|
|
132
134
|
this.isIosMiniApp(window.location)) {
|
|
@@ -146,6 +148,16 @@ class Cpzxrobot {
|
|
|
146
148
|
this.scanQrcode = function () {
|
|
147
149
|
return platform.callHandler("app.scanQrcode");
|
|
148
150
|
};
|
|
151
|
+
this.getGeo = async function () {
|
|
152
|
+
var result = await platform.callHandler("app.getGeo");
|
|
153
|
+
if (result.error) {
|
|
154
|
+
throw result.error;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
lat: result.lat,
|
|
158
|
+
lng: result.lng
|
|
159
|
+
};
|
|
160
|
+
};
|
|
149
161
|
this.setTitle = function (title) {
|
|
150
162
|
platform.callHandler("app.setTitle", title);
|
|
151
163
|
};
|
package/index.ts
CHANGED
|
@@ -46,6 +46,10 @@ export class Cpzxrobot {
|
|
|
46
46
|
saveBlob!: (blob: Blob, filename: string) => void;
|
|
47
47
|
scanQrcode!: () => Promise<string>;
|
|
48
48
|
vibrate!: (time?: number) => void;
|
|
49
|
+
getGeo!: () => Promise<{
|
|
50
|
+
lat: number;
|
|
51
|
+
lng: number;
|
|
52
|
+
}>;
|
|
49
53
|
assistant: AssistantGateway;
|
|
50
54
|
energy: EnergyGateway;
|
|
51
55
|
camera: CameraGateway;
|
|
@@ -58,6 +62,7 @@ export class Cpzxrobot {
|
|
|
58
62
|
company: CompanyGateway = new CompanyGateway(this);
|
|
59
63
|
news: NewsGateway = new NewsGateway(this);
|
|
60
64
|
|
|
65
|
+
|
|
61
66
|
constructor(appCode: string) {
|
|
62
67
|
//获取当前浏览器的域名
|
|
63
68
|
this.ready = new Promise<MyAxiosInstance>((resolve, reject) => {
|
|
@@ -156,6 +161,8 @@ export class Cpzxrobot {
|
|
|
156
161
|
// @ts-ignore
|
|
157
162
|
this.vibrate = window.miniapp.vibrate;
|
|
158
163
|
this.saveBlob = this._saveBlobAsBase64;
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
this.getGeo = window.miniapp.getGeo;
|
|
159
166
|
} else if (
|
|
160
167
|
domain == "appassets.androidplatform.net" ||
|
|
161
168
|
this.isIosMiniApp(window.location)
|
|
@@ -178,6 +185,16 @@ export class Cpzxrobot {
|
|
|
178
185
|
this.scanQrcode = function () {
|
|
179
186
|
return platform.callHandler("app.scanQrcode");
|
|
180
187
|
}
|
|
188
|
+
this.getGeo = async function () {
|
|
189
|
+
var result = await platform.callHandler("app.getGeo");
|
|
190
|
+
if (result.error) {
|
|
191
|
+
throw result.error;
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
lat: result.lat,
|
|
195
|
+
lng: result.lng
|
|
196
|
+
}
|
|
197
|
+
};
|
|
181
198
|
this.setTitle = function (title: string) {
|
|
182
199
|
platform.callHandler("app.setTitle", title);
|
|
183
200
|
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
package/types.d.ts
CHANGED