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

@@ -940,9 +940,7 @@ function stack(views, config) {
finally { if (e_1) { throw e_1.error; } }
}
if (config) {
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -964,9 +962,7 @@ function hlayout(views, config) {
finally { if (e_2) { throw e_2.error; } }
}
if (config) {
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -988,9 +984,7 @@ function vlayout(views, config) {
finally { if (e_3) { throw e_3.error; } }
}
if (config) {
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -1019,9 +1013,7 @@ function flexlayout(views, config) {
finally { if (e_4) { throw e_4.error; } }
}
if (config) {
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -1914,9 +1906,7 @@ var Text = /** @class */ (function (_super) {
function text(config) {
var ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -2105,9 +2095,7 @@ var Image = /** @class */ (function (_super) {
function image(config) {
var ret = new Image;
ret.layoutConfig = layoutConfig().fit();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -2278,9 +2266,7 @@ var List = /** @class */ (function (_super) {
}(Superview));
function list(config) {
var ret = new List;
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function listItem(item, config) {
@@ -2295,9 +2281,7 @@ function listItem(item, config) {
});
}
if (config) {
for (var key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
it.apply(config);
}
});
}
@@ -2401,9 +2385,7 @@ var Slider = /** @class */ (function (_super) {
}(Superview));
function slider(config) {
var ret = new Slider;
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function slideItem(item, config) {
@@ -2453,9 +2435,7 @@ function scroller(content, config) {
return (new Scroller).also(function (v) {
v.layoutConfig = layoutConfig().fit();
if (config) {
for (var key in config) {
Reflect.set(v, key, Reflect.get(config, key, config), v);
}
v.apply(config);
}
v.content = content;
});
@@ -2563,9 +2543,7 @@ var Refreshable = /** @class */ (function (_super) {
function refreshable(config) {
var ret = new Refreshable;
ret.layoutConfig = layoutConfig().fit();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
function pullable(v, config) {
@@ -2832,9 +2810,7 @@ function flowItem(item, config) {
});
}
if (config) {
for (var key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
it.apply(config);
}
});
}
@@ -2989,9 +2965,7 @@ exports.InputType = void 0;
function input(config) {
var ret = new Input;
ret.layoutConfig = layoutConfig().just();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}
@@ -3096,9 +3070,7 @@ function draggable(views, config) {
});
}
if (config) {
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
}
return ret;
}
@@ -3159,9 +3131,7 @@ function switchView(config) {
ret.layoutConfig = layoutConfig().just();
ret.width = 50;
ret.height = 30;
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
ret.apply(config);
return ret;
}

View File

@@ -318,6 +318,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) {
@@ -753,9 +756,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;
}
@@ -766,9 +767,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;
}
@@ -779,9 +778,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;
}
@@ -794,9 +791,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;
}
@@ -1444,9 +1439,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;
}
@@ -1613,9 +1606,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;
}
@@ -1741,9 +1732,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) {
@@ -1758,9 +1747,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);
}
});
}
@@ -1839,9 +1826,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) {
@@ -1876,9 +1861,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;
});
@@ -1961,9 +1944,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) {
@@ -2184,9 +2165,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);
}
});
}
@@ -2320,9 +2299,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;
}
@@ -2386,9 +2363,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;
}
@@ -2429,9 +2404,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;
}

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;
}