未验证 提交 84972c23 编写于 作者: O openharmony_ci 提交者: Gitee

!19867 19708挑单到4.0beta1

Merge pull request !19867 from 田雨/cherry-pick-1687140598
......@@ -68,7 +68,8 @@ getPixelMap(): image.PixelMap;
**示例:**
```ts
pixmap: PixelMap = drawable1.getPixelMap();
pixmap: PixelMap = (<DrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getPixelMap();
```
## LayeredDrawableDescriptor.getPixelMap
......@@ -86,7 +87,8 @@ getPixelMap(): image.PixelMap;
**示例:**
```ts
pixmap: PixelMap = layeredDrawable1.getPixelMap();
pixmap: PixelMap = ((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getForeground()).getPixelMap();
```
## LayeredDrawableDescriptor.getForeground
......@@ -104,7 +106,8 @@ getForeground(): DrawableDescriptor;
**示例:**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getForeground();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getForeground();
```
## LayeredDrawableDescriptor.getBackground
......@@ -122,7 +125,8 @@ getBackground(): DrawableDescriptor;
**示例:**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getBackground();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getBackground();
```
## LayeredDrawableDescriptor.getMask
......@@ -140,5 +144,6 @@ getMask(): DrawableDescriptor;
**示例:**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getMask();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getMask();
```
......@@ -376,10 +376,24 @@ on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ):
| eventType | string | 是 | 监听的事件类型,&nbsp;可选值为:"push"&nbsp;、"request"。<br/>"push”:指组件提供者向使用者主动推送数据。<br/>"request”:指组件使用者向提供者主动请求数据。 |
| callback | [OnPushEventCallback](#onpusheventcallback)&nbsp;\|&nbsp;[OnRequestEventCallback](#onrequesteventcallback) | 是 | 对应监听回调,push事件对应回调类型为[OnPushEventCallback](#onpusheventcallback),request事件对应回调类型为[OnRequestEventCallback](#onrequesteventcallback) 。 |
**示例:**
```js
function onPushListener(source, template, data, extraData) {
console.log("onPushListener template.source=" + template.source)
console.log("onPushListener source=" + JSON.stringify(source))
console.log("onPushListener template=" + JSON.stringify(template))
console.log("onPushListener data=" + JSON.stringify(data))
console.log("onPushListener extraData=" + JSON.stringify(extraData))
}
function onRequestListener(source, name, data) {
console.error("onRequestListener");
console.log("onRequestListener source=" + JSON.stringify(source));
console.log("onRequestListener name=" + name);
console.log("onRequestListener data=" + JSON.stringify(data));
return { template: "ets/pages/plugin.js", data: data };
}
pluginComponentManager.on("push", onPushListener)
pluginComponentManager.on("request", onRequestListener)
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册