-
Notifications
You must be signed in to change notification settings - Fork 16
/
api.txt
613 lines (613 loc) · 22.9 KB
/
api.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
function(e, t, n) {
"use strict";
var r = n(43),
o = "request({\n url: 'https://{{URL}}',\n data: {{{}}},\n method: '{{GET}}', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT\n // header: {}, // 设置请求的 header\n " + r.cb + "\n})",
i = "发起 https 请求。一个微信小程序,同时只能有5个网络请求连接。",
a = {
insertText: o,
documentation: i
};
o = "connectSocket({\n url: \"wss://{{URL}}\",\n data: {{{}}},\n // header: {}, // 设置请求的 header\n method: '{{GET}}', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT\n " + r.cb + "\n})",
i = "创建一个 WebSocket 连接。";
var s = {
insertText: o,
documentation: i
};
o = "onSocketClose(function() {\n {{// callback}}\n})",
i = "监听 WebSocket 关闭。";
var l = {
insertText: o,
documentation: i
};
o = "onSocketError(function() {\n {{// callback}}\n})",
i = "监听 WebSocket 错误。";
var c = {
insertText: o,
documentation: i
};
o = "onSocketMessage(function(data) {\n {{// data}}\n})",
i = "监听 WebSocket 接受到服务器的消息事件。";
var u = {
insertText: o,
documentation: i
};
o = "onSocketOpen(function() {\n {{// callback}}\n})",
i = "监听 WebSocket 连接打开事件。";
var d = {
insertText: o,
documentation: i
};
o = "sendSocketMessage({\n data: '{{String}}',\n " + r.cb + "\n})",
i = "通过 WebSocket 连接发送数据,需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。";
var p = {
insertText: o,
documentation: i
};
o = "downloadFile({\n url: \"https://{{URL}}\",\n // type: 'image', // 下载资源的类型,用于客户端识别处理,有效值:image/audio/video\n // header: {}, // 设置请求的 header\n " + r.cb + "\n})",
i = "下载文件资源到本地。客户端直接发起一个 HTTP GET 请求,把下载到的资源根据 type 进行处理,并返回文件的本地临时路径。";
var f = {
insertText: o,
documentation: i
};
o = "uploadFile({\n url: 'https://{{String}}',\n filePath:'{{filePath}}',\n name:'{{name}}',\n // header: {}, // 设置请求的 header\n // formData: {}, // HTTP 请求中其他额外的 form data\n " + r.cb + "\n})",
i = "将本地资源上传到开发者服务器。";
var h = {
insertText: o,
documentation: i
};
o = "closeSocket()",
i = "关闭 WebSocket 连接。";
var g = {
insertText: o,
documentation: i
};
e.exports = {
request: a,
connectSocket: s,
onSocketClose: l,
onSocketError: c,
onSocketMessage: u,
onSocketOpen: d,
sendSocketMessage: p,
downloadFile: f,
uploadFile: h,
closeSocket: g
}
},
function(e, t) {
"use strict";
var n = "success: function(res){\n {{// success}}\n },\n fail: function() {\n {{// fail}}\n },\n complete: function() {\n {{// complete}}\n }";
e.exports = {
cb: n
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "chooseImage({\n count: {{9}}, // 最多可以选择的图片张数,默认9\n sizeType: [{{'original', 'compressed'}}], // original 原图,compressed 压缩图,默认二者都有\n sourceType: [{{'album', 'camera'}}], // album 从相册选图,camera 使用相机,默认二者都有\n " + r.cb + "\n})",
i = "从本地相册选择图片或使用相机拍照。",
a = {
insertText: o,
documentation: i
};
o = "previewImage({\n // current: '{{String}}', // 当前显示图片的链接,不填则默认为 urls 的第一张\n urls: [{{StringArray}}],\n " + r.cb + "\n})",
i = "预览图片。";
var s = {
insertText: o,
documentation: i
};
o = "getImageInfo({\n src: '{{src}}',\n " + r.cb + "\n})",
i = "获取图片信息。";
var l = {
insertText: o,
documentation: i
};
o = "startRecord({\n " + r.cb + "\n})",
i = "开始录音。当主动调用 wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。";
var c = {
insertText: o,
documentation: i
};
o = "stopRecord({\n " + r.cb + "\n})",
i = " 主动调用停止录音。";
var u = {
insertText: o,
documentation: i
};
o = "playVoice({\n filePath: '{{String}}',\n " + r.cb + "\n})",
i = "开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。";
var d = {
insertText: o,
documentation: i
};
o = "pauseVoice({\n " + r.cb + "\n})",
i = "暂停正在播放的语音。";
var p = {
insertText: o,
documentation: i
};
o = "stopVoice({\n " + r.cb + "\n})",
i = "结束播放语音。";
var f = {
insertText: o,
documentation: i
};
o = "getBackgroundAudioPlayerState({\n " + r.cb + "\n})",
i = "获取音乐播放状态。";
var h = {
insertText: o,
documentation: i
};
o = "playBackgroundAudio({\n dataUrl: '{{String}}',\n " + r.cb + "\n})",
i = "播放音乐,同时只能有一首音乐正在播放。";
var g = {
insertText: o,
documentation: i
};
o = "pauseBackgroundAudio({\n " + r.cb + "\n})",
i = "暂停播放音乐。";
var m = {
insertText: o,
documentation: i
};
o = "seekBackgroundAudio({\n position: {{Number}},\n " + r.cb + "\n})",
i = "控制音乐播放进度。";
var v = {
insertText: o,
documentation: i
};
o = "stopBackgroundAudio({\n " + r.cb + "\n})",
i = "停止播放音乐。";
var b = {
insertText: o,
documentation: i
};
o = "onBackgroundAudioPlay(function() {\n {{// callback}}\n})",
i = "监听音乐播放。";
var y = {
insertText: o,
documentation: i
};
o = "onBackgroundAudioPause(function() {\n {{// callback}}\n})",
i = "监听音乐暂停。";
var A = {
insertText: o,
documentation: i
};
o = "onBackgroundAudioStop(function() {\n {{// callback}}\n})",
i = "监听音乐停止。";
var x = {
insertText: o,
documentation: i
};
o = "chooseVideo({\n sourceType: ['album', 'camera'], // album 从相册选视频,camera 使用相机拍摄\n // maxDuration: 60, // 拍摄视频最长拍摄时间,单位秒。最长支持60秒\n camera: ['front', 'back'],\n " + r.cb + "\n})",
i = "拍摄视频或从手机相册中选视频,返回视频的临时文件路径。";
var E = {
insertText: o,
documentation: i
};
o = "createAudioContext({{AudioId}})\n",
i = "创建并返回 audio 上下文 audioContext 对象。";
var w = {
insertText: o,
documentation: i
};
o = "createVideoContext({{VideoId}})\n",
i = "创建并返回 video 上下文 videoContext 对象。";
var C = {
insertText: o,
documentation: i
};
e.exports = {
chooseImage: a,
previewImage: s,
getImageInfo: l,
startRecord: c,
stopRecord: u,
playVoice: d,
pauseVoice: p,
stopVoice: f,
getBackgroundAudioPlayerState: h,
playBackgroundAudio: g,
pauseBackgroundAudio: m,
seekBackgroundAudio: v,
stopBackgroundAudio: b,
onBackgroundAudioPlay: y,
onBackgroundAudioPause: A,
onBackgroundAudioStop: x,
chooseVideo: E,
createAudioContext: w,
createVideoContext: C
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "saveFile({\n tempFilePath: '{{String}}',\n " + r.cb + "\n})",
i = "保存文件到本地。",
a = {
insertText: o,
documentation: i
};
o = "openDocument({\n filePath: '{{String}}',\n " + r.cb + "\n})",
i = "在新 webview 打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。";
var s = {
insertText: o,
documentation: i
};
o = "getSavedFileList({\n " + r.cb + "\n})",
i = "获取该小程序下已保存的文件列表。";
var l = {
insertText: o,
documentation: i
};
o = "getSavedFileInfo({\n filePath: '{{String}}',\n " + r.cb + "\n})",
i = "获取该已保存的文件信息。";
var c = {
insertText: o,
documentation: i
};
o = "removeSavedFile({\n filePath: '{{String}}',\n " + r.cb + "\n})",
i = "删除已保存的文件。";
var u = {
insertText: o,
documentation: i
};
e.exports = {
saveFile: a,
openDocument: s,
getSavedFileList: l,
getSavedFileInfo: c,
removeSavedFile: u
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "setStorage({\n key: '{{String}}',\n data: {{Object/String}},\n " + r.cb + "\n})",
i = "将数据存储在本地缓存中指定的 key 中,这是一个异步接口。",
a = {
insertText: o,
documentation: i
};
o = "setStorageSync('{{String}}', {{Object/String}})",
i = "将 data 存储在本地缓存中指定的 key 中,这是一个同步接口。";
var s = {
insertText: o,
documentation: i
};
o = "getStorage({\n key: '{{String}}',\n " + r.cb + "\n})",
i = "从本地缓存中异步获取指定 key 对应的内容,这是一个异步接口。";
var l = {
insertText: o,
documentation: i
};
o = "getStorageSync('{{String}}')",
i = "从本地缓存中同步获取指定 key 对应的内容,这是一个同步接口。";
var c = {
insertText: o,
documentation: i
};
o = "clearStorage({\n key: '{{String}}',\n " + r.cb + "\n})",
i = "清理本地数据缓存,这是一个异步接口。";
var u = {
insertText: o,
documentation: i
};
o = "clearStorageSync()",
i = "清理本地数据缓存,这是一个同步接口。";
var d = {
insertText: o,
documentation: i
};
o = "getStorageInfo({\n key: '{{String}}',\n " + r.cb + "\n})",
i = "获取 storage 相关信息,这是一个异步接口。";
var p = {
insertText: o,
documentation: i
};
o = "getStorageInfoSync()",
i = "获取 storage 相关信息,这是一个同步接口。";
var f = {
insertText: o,
documentation: i
};
o = "removeStorage({\n key: '{{String}}',\n " + r.cb + "\n})",
i = "指定 key 删除本地数据,这是一个异步接口。";
var h = {
insertText: o,
documentation: i
};
o = "removeStorageSync('{{String}}')",
i = "指定 key 删除本地数据,这是一个同步接口。";
var g = {
insertText: o,
documentation: i
};
e.exports = {
setStorage: a,
setStorageSync: s,
getStorage: l,
getStorageSync: c,
clearStorage: u,
clearStorageSync: d,
getStorageInfo: p,
getStorageInfoSync: f,
removeStorage: h,
removeStorageSync: g
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "getLocation({\n type: '{{wgs84}}', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标\n " + r.cb + "\n})",
i = "获取当前的地理位置、速度。",
a = {
insertText: o,
documentation: i
};
o = "openLocation({\n latitude: {{Float}}, // 纬度,范围为-90~90,负数表示南纬\n longitude: {{Float}}, // 经度,范围为-180~180,负数表示西经\n scale: {{28}}, // 缩放比例\n // name: '{{name}}', // 位置名\n // address: '{{address}}', // 地址的详细说明\n " + r.cb + "\n})",
i = "使用微信内置地图查看位置。";
var s = {
insertText: o,
documentation: i
};
o = "chooseLocation({\n " + r.cb + "\n})",
i = "调起原生地图选点界面,返回用户所选的位置名称及经纬度。";
var l = {
insertText: o,
documentation: i
};
o = "createMapContext({{MapId}})\n",
i = "创建并返回 map 上下文 mapContext 对象。";
var c = {
insertText: o,
documentation: i
};
e.exports = {
getLocation: a,
openLocation: s,
chooseLocation: l,
createMapContext: c
}
},
function(e, t) {
"use strict";
var n = "getNetworkType({\n success: function(res) {\n {{// success}}\n }\n})",
r = "获取网络类型。",
o = {
insertText: n,
documentation: r
};
n = "getSystemInfo({\n success: function(res) {\n {{// success}}\n }\n})",
r = "获取系统信息,这是一个异步接口。";
var i = {
insertText: n,
documentation: r
};
n = "getSystemInfoSync()",
r = "获取系统信息,这是一个同步接口。";
var a = {
insertText: n,
documentation: r
};
n = "onAccelerometerChange(function(res){\n {{// callback}}\n})",
r = "监听重力感应数据,频率:5次/秒。";
var s = {
insertText: n,
documentation: r
};
n = "onCompassChange(function(res){\n {{// callback}}\n})",
r = "监听罗盘数据,频率:5次/秒。";
var l = {
insertText: n,
documentation: r
};
n = "makePhoneCall({\n phoneNumber: '{{String}}',\n success: function(res) {\n {{// success}}\n }\n})",
r = "拨打电话";
var c = {
insertText: n,
documentation: r
};
n = "scanCode({\n success: function(res) {\n {{// success}}\n },\n fail: function(res) {\n {{// fail}}\n },\n complete: function(res) {\n {{// complete}}\n }\n})",
r = "调起扫码界面";
var u = {
insertText: n,
documentation: r
};
e.exports = {
getNetworkType: o,
getSystemInfo: i,
getSystemInfoSync: a,
onAccelerometerChange: s,
onCompassChange: l,
makePhoneCall: c,
scanCode: u
}
},
function(e, t) {
"use strict";
var n = "setNavigationBarTitle({\n title: '{{String}}',\n success: function(res) {\n {{// success}}\n }\n})",
r = "动态设置当前页面的标题。",
o = {
insertText: n,
documentation: r
};
n = "hideNavigationBarLoading()",
r = "隐藏导航条加载动画。";
var i = {
insertText: n,
documentation: r
};
n = "showNavigationBarLoading()",
r = "在当前页面显示导航条加载动画。";
var a = {
insertText: n,
documentation: r
};
e.exports = {
setNavigationBarTitle: o,
showNavigationBarLoading: a,
hideNavigationBarLoading: i
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "navigateTo({\n url: '{{String}}',\n " + r.cb + "\n})",
i = "保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。",
a = {
insertText: o,
documentation: i
};
o = "redirectTo({\n url: '{{String}}',\n " + r.cb + "\n})",
i = "关闭当前页面,跳转到应用内的某个页面。";
var s = {
insertText: o,
documentation: i
};
o = "navigateBack({\n delta: {{1}}, // 回退前 delta(默认为1) 页面\n " + r.cb + "\n})",
i = "关闭当前页面,回退前 delta(默认为1) 页面。";
var l = {
insertText: o,
documentation: i
};
o = "switchTab({\n url: '{{String}}',\n " + r.cb + "\n})",
i = "跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面";
var c = {
insertText: o,
documentation: i
};
e.exports = {
navigateTo: a,
redirectTo: s,
navigateBack: l,
switchTab: c
}
},
function(e, t) {
"use strict";
var n = 'createAnimation({\n duration: 400,\n timingFunction: \'linear\', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"\n delay: 0,\n transformOrigin: \'50% 50% 0\',\n success: function(res) {\n {{function code}}\n }\n})',
r = "创建一个动画实例 animation。",
o = {
insertText: n,
documentation: r
};
e.exports = {
createAnimation: o
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "createContext()",
i = "创建并返回绘图上下文context对象。",
a = {
insertText: o,
documentation: i
};
o = "drawCanvas({\n canvasId: '{{String}}',\n actions: {{actions}}\n})",
i = "drawCanvas。";
var s = {
insertText: o,
documentation: i
};
o = "canvasToTempFilePath({\n canvasId: {{canvasId}},\n " + r.cb + "\n})\n",
i = "将 canvas 导出为图片,并返回临时文件路劲。";
var l = {
insertText: o,
documentation: i
};
o = "canvasToTempFilePath({\n canvasId: {{canvasId}}\n})\n",
i = "创建 canvas 绘图上下文(指定 canvasId)";
var c = {
insertText: o,
documentation: i
};
e.exports = {
createContext: a,
drawCanvas: s,
canvasToTempFilePath: l,
createCanvasContext: c
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "hideKeyboard()",
i = "收起键盘。",
a = {
insertText: o,
documentation: i
};
o = "stopPullDownRefresh()",
i = "停止当前页面下拉刷新。";
var s = {
insertText: o,
documentation: i
};
o = "scanCode({\n " + r.cb + "\n})",
i = "调起客户端扫码界面,扫码成功后返回对应的结果";
var l = {
insertText: o,
documentation: i
};
e.exports = {
hideKeyboard: a,
stopPullDownRefresh: s,
scanCode: l
}
},
function(e, t, n) {
"use strict";
var r = n(43),
o = "login({\n " + r.cb + "\n})",
i = "调用接口获取登录凭证(code)进而换取用户登录态信息,包括用户的唯一标识(openid) 及本次登录的 会话密钥(session_key)。",
a = {
insertText: o,
documentation: i
};
o = "getUserInfo({\n " + r.cb + "\n})",
i = "获取用户信息,需要先调用 wx.login 接口。";
var s = {
insertText: o,
documentation: i
};
o = "requestPayment({\n timeStamp: '{{String1}}',\n nonceStr: '{{String2}}',\n package: '{{String3}}',\n signType: 'MD5',\n paySign: '{{String4}}',\n " + r.cb + "\n})",
i = "发起微信支付。";
var l = {
insertText: o,
documentation: i
};
e.exports = {
login: a,
getUserInfo: s,
requestPayment: l
}
},
function(e, t) {
"use strict";
var n = "App({\n onLaunch: function () {\n {{String1}}\n },\n onShow: function () {\n {{String2}}\n },\n onHide: function () {\n {{String3}}\n },\n onError: function (msg) {\n {{String4}}\n }\n})",
r = "使用 App 函数来生成一个程序实例",
o = monaco.languages.CompletionItemKind.Function,
i = "App";
e.exports = {
insertText: n,
documentation: r,
kind: o,
label: i
}
},
function(e, t) {
"use strict";
var n = "Page({\n data:{\n {{String1}}\n },\n onLoad:function(options){\n // 生命周期函数--监听页面加载\n {{String2}}\n },\n onReady:function(){\n // 生命周期函数--监听页面初次渲染完成\n {{String3}}\n },\n onShow:function(){\n // 生命周期函数--监听页面显示\n {{String4}}\n },\n onHide:function(){\n // 生命周期函数--监听页面隐藏\n {{String5}}\n },\n onUnload:function(){\n // 生命周期函数--监听页面卸载\n {{String6}}\n },\n onPullDownRefresh: function() {\n // 页面相关事件处理函数--监听用户下拉动作\n {{String7}}\n },\n onReachBottom: function() {\n // 页面上拉触底事件的处理函数\n {{String8}}\n },\n onShareAppMessage: function() {\n // 用户点击右上角分享\n return {\n title: '{{title}}', // 分享标题\n desc: '{{desc}}', // 分享描述\n path: '{{path}}' // 分享路径\n }\n }\n})",
r = "使用 Page 函数来生成一个页面实例",
o = monaco.languages.CompletionItemKind.Function,
i = "Page";
e.exports = {
insertText: n,
documentation: r,
kind: o,
label: i
}
},