1. add PixelMapPack for README.md

2. add copyright and license for worker1.js

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2022-03-21 18:09:07 +08:00
parent 91d81d5210
commit a178a01117
2 changed files with 25 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# GlideJS # ImageKnife
**专门为OpenHarmony打造的一款图像加载缓存库致力于更高效、更轻便、更简单** **专门为OpenHarmony打造的一款图像加载缓存库致力于更高效、更轻便、更简单**
@ -15,7 +15,7 @@
``` ```
/entry/src/ /entry/src/
- main/ets/default - main/ets/MainAbility
- cache # 缓存相关内容 - cache # 缓存相关内容
- diskstrategy # 缓存策略 - diskstrategy # 缓存策略
- key # 缓存key生成策略 - key # 缓存key生成策略
@ -224,10 +224,16 @@ struct Index {
##### 步骤1 ##### 步骤1
定义一个入参 PixelMap 定义自定义类
export default class PixelMapPack{
pixelMap:PixelMap;
}
使用@State关联PixelMapPack
```typescript ```typescript
@State tomatoPixelMap:PixelMap = new PixelMap(); @State glidePixelMapPack:PixelMapPack = new PixelMapPack();
width:number = 200; width:number = 200;
height:number = 200; height:number = 200;
``` ```
@ -237,7 +243,7 @@ height:number = 200;
在你的component组件中写下一个Image组件将基础参数入参PixelMap组件的宽、高配置好 在你的component组件中写下一个Image组件将基础参数入参PixelMap组件的宽、高配置好
``` ```
Image(this.tomatoPixelMap) Image(this.glidePixelMapPack.pixelMap)
.backgroundColor(Color.Grey) .backgroundColor(Color.Grey)
.objectFit(ImageFit.Contain) .objectFit(ImageFit.Contain)
.width(this.width) .width(this.width)

View File

@ -1,9 +1,19 @@
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import arkWorker from '@ohos.worker'; import arkWorker from '@ohos.worker';
function foo(x) {
return x
}
arkWorker.parentPort.onmessage = function (e) { arkWorker.parentPort.onmessage = function (e) {
var data = e.data; var data = e.data;
switch (data.type) { switch (data.type) {