optimize js code

This commit is contained in:
pengfei.zhou
2021-08-31 12:49:47 +08:00
committed by osborn
parent 612e5a4a07
commit 1b10106eb3
31 changed files with 109 additions and 271 deletions

View File

@@ -1842,6 +1842,9 @@ class View {
getLocationOnScreen(context) {
return this.nativeChannel(context, "getLocationOnScreen")();
}
set props(props) {
this.apply(props);
}
doAnimation(context, animation) {
return this.nativeChannel(context, "doAnimation")(animation.toModel()).then((args) => {
for (let key in args) {
@@ -2277,9 +2280,7 @@ function stack(views, config) {
ret.addChild(v);
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -2290,9 +2291,7 @@ function hlayout(views, config) {
ret.addChild(v);
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -2303,9 +2302,7 @@ function vlayout(views, config) {
ret.addChild(v);
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -2318,9 +2315,7 @@ function flexlayout(views, config) {
ret.addChild(v);
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -2968,9 +2963,7 @@ __decorate$a([
function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -3137,9 +3130,7 @@ __decorate$9([
function image(config) {
const ret = new Image;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -3265,9 +3256,7 @@ __decorate$8([
], List.prototype, "bounces", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function listItem(item, config) {
@@ -3282,9 +3271,7 @@ function listItem(item, config) {
});
}
if (config) {
for (let key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
it.apply(config);
}
});
}
@@ -3363,9 +3350,7 @@ __decorate$7([
], Slider.prototype, "bounces", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function slideItem(item, config) {
@@ -3400,9 +3385,7 @@ function scroller(content, config) {
return (new Scroller).also(v => {
v.layoutConfig = layoutConfig().fit();
if (config) {
for (let key in config) {
Reflect.set(v, key, Reflect.get(config, key, config), v);
}
v.apply(config);
}
v.content = content;
});
@@ -3485,9 +3468,7 @@ __decorate$5([
function refreshable(config) {
const ret = new Refreshable;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function pullable(v, config) {
@@ -3708,9 +3689,7 @@ function flowItem(item, config) {
});
}
if (config) {
for (let key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
it.apply(config);
}
});
}
@@ -3844,9 +3823,7 @@ exports.InputType = void 0;
function input(config) {
const ret = new Input;
ret.layoutConfig = layoutConfig().just();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -3910,9 +3887,7 @@ function draggable(views, config) {
});
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -3953,9 +3928,7 @@ function switchView(config) {
ret.layoutConfig = layoutConfig().just();
ret.width = 50;
ret.height = 30;
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}