Skip to content

Commit

Permalink
update to base lib 2.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SgLy committed Dec 6, 2019
1 parent 83622dd commit ff08d2d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2019-12-06 v2.9.3
- 同步 API 定义到基础库 2.9.3
- 补齐 `Component` 纯数据字段(`pureDataPattern`
- 支持 `Component` 的属性监听器使用 `string` 类型

## 2019-11-14 v2.9.2
- 同步 API 定义到基础库 2.9.2
- 补齐 `Behaviors` 中缺少的一些选项
Expand Down
1 change: 1 addition & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

基础库版本|npm 版本|命令
-|-|-
[v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install [email protected]`
[v2.9.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-2-2019-11-04) | [2.9.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.2) | `npm install [email protected]`
[v2.9.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-1-2019-10-29) | [2.9.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.1) | `npm install [email protected]`
[v2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-0-2019-10-09) | [2.9.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.0) | `npm install [email protected]`
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miniprogram-api-typings",
"version": "2.9.2",
"version": "2.9.3",
"description": "Type definitions for APIs of Wechat Mini Program in TypeScript",
"main": "./index.d.ts",
"types": "./index.d.ts",
Expand Down
32 changes: 32 additions & 0 deletions test/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,35 @@ expectError(
},
}),
)

Component({
options: {
pureDataPattern: /^_/,
},
data: {
a: true, // 普通数据字段
_b: true, // 纯数据字段
},
methods: {
myMethod() {
this.data._b // 纯数据字段可以在 this.data 中获取
this.setData({
c: true, // 普通数据字段
_d: true, // 纯数据字段
})
},
},
})

Component({
properties: {
a: {
type: Number,
observer: 'onAChange',
value: 1,
},
},
methods: {
onAChange() {},
},
})
18 changes: 9 additions & 9 deletions types/wx/lib.wx.api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5098,7 +5098,7 @@ innerAudioContext.onError((res) => {
USER_DATA_PATH: string
}
interface Animation {
/** [Array.<Object> Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
/** [Array.&lt;Object&gt; Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
*
* 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */
export(): IAnyObject[]
Expand Down Expand Up @@ -6514,7 +6514,7 @@ ctx.draw()
* - 'square': 向线条的每个末端添加正方形线帽。; */
lineCap: 'butt' | 'round' | 'square',
): void
/** [CanvasContext.setLineDash(Array.<number> pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
/** [CanvasContext.setLineDash(Array.&lt;number&gt; pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
*
* 设置虚线样式。
*
Expand Down Expand Up @@ -7317,7 +7317,7 @@ this.editorCtx.insertImage({
): void
}
interface FileSystemManager {
/** [Array.<string> FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
/** [Array.&lt;string&gt; FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
*
* [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */
readdirSync(
Expand Down Expand Up @@ -10961,7 +10961,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offAccelerometerChange(
/** 加速度数据事件的回调函数 */
callback: (...args: any[]) => any,
Expand Down Expand Up @@ -11060,7 +11060,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offCompassChange(
/** 罗盘数据变化事件的回调函数 */
callback: (...args: any[]) => any,
Expand All @@ -11069,7 +11069,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offDeviceMotionChange(
/** 设备方向变化事件的回调函数 */
callback: (...args: any[]) => any,
Expand All @@ -11096,7 +11096,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 取消监听陀螺仪数据变化事件。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offGyroscopeChange(
/** 陀螺仪数据变化事件的回调函数 */
callback: (...args: any[]) => any,
Expand Down Expand Up @@ -11177,7 +11177,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offNetworkStatusChange(
/** 网络状态变化事件的回调函数 */
callback: (...args: any[]) => any,
Expand All @@ -11195,7 +11195,7 @@ wx.notifyBLECharacteristicValueChange({
*
* 用户主动截屏事件。取消事件监听。
*
* 最低基础库: `2.8.1` */
* 最低基础库: `2.9.3` */
offUserCaptureScreen(
/** 用户主动截屏事件的回调函数 */
callback: (...args: any[]) => any,
Expand Down
16 changes: 11 additions & 5 deletions types/wx/lib.wx.component.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ declare namespace WechatMiniprogram {
/** 属性初始值 */
value?: ValueType<T>
/** 属性值被更改时的响应函数 */
observer?(
newVal: ValueType<T>,
oldVal: ValueType<T>,
changedPath: Array<string | number>,
): void
observer?:
| string
| ((
newVal: ValueType<T>,
oldVal: ValueType<T>,
changedPath: Array<string | number>,
) => void)
/** 属性的类型(可以指定多个) */
optionalTypes?: ShortProperty[]
}
Expand Down Expand Up @@ -206,6 +208,10 @@ declare namespace WechatMiniprogram {
| 'page-isolated'
| 'page-apply-shared'
| 'page-shared'
/**
* [纯数据字段](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/pure-data.html) 是一些不用于界面渲染的 data 字段,可以用于提升页面更新性能。从小程序基础库版本 2.8.2 开始支持。
*/
pureDataPattern?: RegExp
}

interface TriggerEventOption {
Expand Down

0 comments on commit ff08d2d

Please sign in to comment.