efront 3.34.11 → 3.34.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coms/basic_/readme.md +24 -7
- package/coms/zimoli/transition.js +4 -4
- package/coms/zimoli/tree.js +2 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic_/readme.md
CHANGED
|
@@ -10,8 +10,25 @@
|
|
|
10
10
|
import(...)
|
|
11
11
|
```
|
|
12
12
|
用`import(...)`导入的结果,efront不会主动包装一层Promise,如果你在模块的根作用域中中使用了`await`,返回结果就是一个`Promise`的实例,否则你在导入的文件内导出了什么,这个`import(...)`的结果就是什么。如果你不确定导入文件的内容,不盲目使用`import(...).then(...)`这类的方法,可以使用`await import(...)`等待导入完成。
|
|
13
|
-
|
|
14
13
|
3. ```javascript
|
|
14
|
+
(function (a){
|
|
15
|
+
if (a === void 0) a = 1;
|
|
16
|
+
a = 1;
|
|
17
|
+
console.log(arguments[0])// 1
|
|
18
|
+
}(0));
|
|
19
|
+
(function (a){"use strict"
|
|
20
|
+
if (a === void 0) a = 1;
|
|
21
|
+
a = 1;
|
|
22
|
+
console.log(arguments[0])// 0
|
|
23
|
+
}(0));
|
|
24
|
+
(function (a = 1){
|
|
25
|
+
a = 1;
|
|
26
|
+
console.log(arguments[0])// 0
|
|
27
|
+
}(0));
|
|
28
|
+
```
|
|
29
|
+
非严格模式且没有默认值的`arguments`是会被代码中的语句改掉的,而其他两种情况不会。`efront`和`typescript`在把默认值赋值的语句移动到函数体内时,都没有处理这一细节,即原来只读的`arguments`可能被函数内的语句改掉。`efront`内提供的一些组件,可能也会有一部分有无法降级使用的问题,如果您发现的相关的问题,可以向我反馈,我会尽快处理。
|
|
30
|
+
|
|
31
|
+
4. ```javascript
|
|
15
32
|
async function () {
|
|
16
33
|
await ...;
|
|
17
34
|
arguments; // typescript 转换后arguments对象的内容有误
|
|
@@ -24,7 +41,7 @@
|
|
|
24
41
|
```
|
|
25
42
|
这不是一个难解决的问题,应该只是`typescript`已发现但不愿解决的问题。`efront`在降级编译时临时使用变量重命名的方法对代码中的`arguments`进行替换使其内容与原生高级代码一致。
|
|
26
43
|
|
|
27
|
-
|
|
44
|
+
5. ```javascript
|
|
28
45
|
Object.keys
|
|
29
46
|
Object.create
|
|
30
47
|
Array.prototype.map
|
|
@@ -35,7 +52,7 @@
|
|
|
35
52
|
Function.prototype.bind
|
|
36
53
|
```
|
|
37
54
|
以上几个方法`ie9+`系列浏览器已支持,但`ie8`及以下版本不支持,如果没有指定`--no-polyfill`参数`efront`在降级编译期会使用`[]map.js`中提供的方法进行修补,这些方法会在加载器检测到浏览器不支持`[].map`时进行初始化
|
|
38
|
-
|
|
55
|
+
6. ```javascript
|
|
39
56
|
Array.prototype.fill
|
|
40
57
|
Array(3).fill(0) // 类似这种的将变成[0,0,0]一个常量数组
|
|
41
58
|
var [a,b,c]=Array(3).fill(0).map((_,i)=>i+1) // 类似这种用于生成常量并赋值的,将直接变成赋值语句 var a=1,b=2,c=3
|
|
@@ -43,11 +60,11 @@
|
|
|
43
60
|
```
|
|
44
61
|
`Array(...).fill(...).map(...)`这种写法经常被`efront`开发者用来生成自增赋值序列,并且非所有运行环境都支持,所以包括其它显式用到`Array.prototype.fill`的几种写法都会被替换。为了目标代码的性能考虑,这种替换在自动常量化之前就要执行,所以不再支持用`polyfill`的开关进行关闭。如果要关闭,请使用参数`--no-autoeval`将自动常量化的功能一同关闭。
|
|
45
62
|
|
|
46
|
-
|
|
63
|
+
7. ```javascript
|
|
47
64
|
Object.assign
|
|
48
65
|
```
|
|
49
66
|
Object.assign,`ie`系列浏览器均不支持,由于经常被`efront`开发者使用,在降级编译期,如果没有指定`--no-polyfill`参数,将由`efront`处理成替代品[extend](../basic/extend.js)
|
|
50
|
-
|
|
67
|
+
8. ```javascript
|
|
51
68
|
Promise
|
|
52
69
|
Promise.prototype.then
|
|
53
70
|
Promise.prototype.catch
|
|
@@ -57,13 +74,13 @@
|
|
|
57
74
|
Promise.resolve
|
|
58
75
|
```
|
|
59
76
|
`Promise`对象也是`ie`系列浏览器均不支持的。`efront`实现的`Promise`与原生的特性并不一致,仅在运行环境不支持的时候进行替代。比如由`.then`触发的方法与`setTimeout`触发的方法执行的先后顺序会与高级的运行环境有所区别,但也会保持在当前语境执行后再执行相关的语句。以上没有提到的`Promise`相关的方法均不支持,如`Promise.prototype.finally`,如果您使用了这些缺失的特性,就只能自己实现或找类似[core-js](https://github.com/zloirock/core-js)的库填充了
|
|
60
|
-
|
|
77
|
+
9. ```javascript
|
|
61
78
|
obj.if
|
|
62
79
|
obj.catch
|
|
63
80
|
obj.for
|
|
64
81
|
```
|
|
65
82
|
类似这种用`.`取属性的语句,由于属性名与`js`的保留字一样,`ie6`等浏览器会报错,但您可以在`efront`提供的环境中放心使用。因为`efront`本身就会把取属性的语句处理掉。
|
|
66
|
-
|
|
83
|
+
10. `ie8`及以下浏览器中存在的一些与现代`js`标准不同的特性,`efront`提供的组件可能不兼容,在处理为这类环境进行应用开发时,应避免使用。
|
|
67
84
|
```javascript
|
|
68
85
|
Object.defineProperty(...);
|
|
69
86
|
({
|
|
@@ -17,8 +17,9 @@ function transition(target, isLeave, _initialStyle = target.initialStyle || targ
|
|
|
17
17
|
isLeave = parseKV(isLeave, ';', ":");
|
|
18
18
|
}
|
|
19
19
|
if (isObject(isLeave) && (_initialStyle === true || !_initialStyle)) {
|
|
20
|
+
var temp = _initialStyle;
|
|
20
21
|
_initialStyle = isLeave;
|
|
21
|
-
isLeave =
|
|
22
|
+
isLeave = temp;
|
|
22
23
|
}
|
|
23
24
|
if (isLeave) {
|
|
24
25
|
_initialStyle = target.leavingStyle || target.leaveStyle || _initialStyle;
|
|
@@ -30,7 +31,6 @@ function transition(target, isLeave, _initialStyle = target.initialStyle || targ
|
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
if (!target.style) return;
|
|
33
|
-
|
|
34
34
|
var initialStyle = _initialStyle || target.initialStyle;
|
|
35
35
|
var { recoverStyle, transitionTimerStart, transitionTimerEnd } = target;
|
|
36
36
|
clearTimeout(transitionTimerStart);
|
|
@@ -39,7 +39,7 @@ function transition(target, isLeave, _initialStyle = target.initialStyle || targ
|
|
|
39
39
|
initialStyle = parseKV(initialStyle, ";", ":");
|
|
40
40
|
}
|
|
41
41
|
if (isObject(initialStyle)) {
|
|
42
|
-
|
|
42
|
+
var transitionDuration = 100;
|
|
43
43
|
if (!initialStyle.transition) {
|
|
44
44
|
initialStyle.transition = "all .3s ease";
|
|
45
45
|
}
|
|
@@ -53,7 +53,7 @@ function transition(target, isLeave, _initialStyle = target.initialStyle || targ
|
|
|
53
53
|
if (!recoverStyle) {
|
|
54
54
|
recoverStyle = {};
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
var savedStyle = Object.create(null);
|
|
57
57
|
{
|
|
58
58
|
let originalStyle = target.style;
|
|
59
59
|
for (let k in initialStyle) {
|
package/coms/zimoli/tree.js
CHANGED
|
@@ -216,7 +216,9 @@ function tree() {
|
|
|
216
216
|
}
|
|
217
217
|
setState(false);
|
|
218
218
|
z0();
|
|
219
|
+
console.log(change_elem.getAttribute("style"),margin_top)
|
|
219
220
|
var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
|
|
221
|
+
console.log(change_elem.getAttribute("style"),margin_top)
|
|
220
222
|
timeout(z1, res);
|
|
221
223
|
}
|
|
222
224
|
});
|