efront 4.1.14 → 4.2.1
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-en.md +29 -17
- package/coms/basic_/readme.md +16 -6
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic_/readme-en.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
2. ```javascript
|
|
11
11
|
import(...)
|
|
12
12
|
```
|
|
13
|
-
|
|
13
|
+
The result imported with `import (...)`, efront will not actively wrap a layer of Promise. If you use `await` in the root scope of the module, the returned result is an instance of `Promise`. Otherwise, what you export in the imported file will be the result of this `import(...)`. If you are unsure about the content of the imported file and do not blindly use methods such as `import(...).then (...)`, you can use `await import(...)` to wait for the import to complete.
|
|
14
14
|
|
|
15
15
|
3. ```javascript
|
|
16
16
|
import.meta
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
```
|
|
21
21
|
If the above features are used, the compilation can be successful, but it is inconsistent with the content of the native high-level code. Where `import.meta.url` will be the relative path (excluding` file:///... `), and does not include `?` or `#`. the `new.target` will always be `undefined` and should not be used as much as possible.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
4. ```javascript
|
|
24
24
|
(function (a){
|
|
25
25
|
if (a === void 0) a = 1;
|
|
26
26
|
a = 1;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
```
|
|
39
39
|
`arguments` that are not in strict mode and do not have default values will be changed by statements in the code, while the other two cases will not. When the `efront` and `typescript` move the default value assignment statement into the function body, they do not handle this detail, that is, the original read-only `arguments` may be changed by the statement inside the function. Some of the components provided in efront may also have issues that prevent them from being downgraded for use. If you find any related issues, please feel free to provide feedback to me and I will handle them as soon as possible.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
5. ```javascript
|
|
42
42
|
async function () {
|
|
43
43
|
await ...;
|
|
44
44
|
arguments;
|
|
@@ -49,9 +49,21 @@
|
|
|
49
49
|
arguments;
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
|
-
After converting these two types of new functions with `typescript`, the content of the `arguments` object is incorrect. This is not a difficult problem to solve, it should just be a problem that `typescript` has discovered but is unwilling to solve. During downgrade compilation, use variable renaming to temporarily replace the `arguments` in the code to make its content consistent with the native high-level code.
|
|
52
|
+
After converting these two types of new functions with `typescript`, the content of the `arguments` object is incorrect. This is not a difficult problem to solve, it should just be a problem that `typescript` has discovered but is unwilling to solve. During downgrade compilation, use variable renaming to temporarily replace the `arguments` in the code to make its content consistent with the native high-level code.
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
6. ```javascript
|
|
55
|
+
async function(data){
|
|
56
|
+
var reg = /abc/ig,res;
|
|
57
|
+
// If concurrent calls are required, a new object needs to be copied here
|
|
58
|
+
reg = new RegExp(reg.source, reg.flags)
|
|
59
|
+
while(res = reg.exec(data)){
|
|
60
|
+
await ...;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
Because `efront` extracts regular expressions, the same regular expression has only one singleton object globally. If you want to use it concurrently, please temporarily copy an instance before use.
|
|
65
|
+
|
|
66
|
+
7. ```javascript
|
|
55
67
|
Object.keys
|
|
56
68
|
Object.create
|
|
57
69
|
Array.prototype.map
|
|
@@ -61,9 +73,9 @@ After converting these two types of new functions with `typescript`, the content
|
|
|
61
73
|
String.prototype.trim// Inconsistent implementation in different support environments, and inconsistent understanding of whitespace by major manufacturers
|
|
62
74
|
Function.prototype.bind
|
|
63
75
|
```
|
|
64
|
-
The above methods are supported by the `ie9+` series of browsers, but not by the 'ie8' and the following versions. If the `--no-polyfill` parameter is not specified, the methods provided in `[]map.js` will be used to patch during the downgrade compile time. These methods will be initialized when the loader detects that the browser does not support `[].map`
|
|
76
|
+
The above methods are supported by the `ie9+` series of browsers, but not by the 'ie8' and the following versions. If the `--no-polyfill` parameter is not specified, the methods provided in `[]map.js` will be used to patch during the downgrade compile time. These methods will be initialized when the loader detects that the browser does not support `[].map`
|
|
65
77
|
|
|
66
|
-
|
|
78
|
+
8. ```javascript
|
|
67
79
|
Array.prototype.fill
|
|
68
80
|
Array(3).fill(0) // Similar to this will become a constant array of [0,0,0]
|
|
69
81
|
var [a,b,c]=Array(3).fill(0).map((_,i)=>i+1) // Similar to those used to generate constants and assign values, they will directly become assignment statements: var a=1,b=2,c=3
|
|
@@ -71,12 +83,12 @@ The above methods are supported by the `ie9+` series of browsers, but not by the
|
|
|
71
83
|
```
|
|
72
84
|
`Array(...).fill(...).map(...)` is often used by `efront` developers to generate self increasing assignment sequences, and not all runtime environments support it. Therefore, several other writing methods that explicitly use `Array.prototype.fill` will be replaced. For the sake of the performance of the Object code, this replacement must be executed before the automatic constant. Therefore, the switch `polyfill` is no longer supported. If you want to turn off, please use the parameter `--no-autoeval` to turn off the automatic constant function together.
|
|
73
85
|
|
|
74
|
-
|
|
86
|
+
9. ```javascript
|
|
75
87
|
Object.assign
|
|
76
88
|
```
|
|
77
|
-
Object.assign and `ie` series browsers are not supported. Because they are often used by `efront` developers, during the downgrade Compile time period, if the '--no-polyfill' parameter is not specified, `efront` will be processed as a substitute [extend](../basic/extend.js)
|
|
89
|
+
Object.assign and `ie` series browsers are not supported. Because they are often used by `efront` developers, during the downgrade Compile time period, if the '--no-polyfill' parameter is not specified, `efront` will be processed as a substitute [extend](../basic/extend.js)
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
10. ```javascript
|
|
80
92
|
Promise
|
|
81
93
|
Promise.prototype.then
|
|
82
94
|
Promise.prototype.catch
|
|
@@ -85,16 +97,16 @@ Object.assign and `ie` series browsers are not supported. Because they are often
|
|
|
85
97
|
Promise.reject
|
|
86
98
|
Promise.resolve
|
|
87
99
|
```
|
|
88
|
-
The `Promise` object is also not supported by the IE series of browsers. The `Promise` implemented by `efront` is not consistent with the native features and is only replaced when the runtime environment does not support it. For example, the execution order of methods triggered by `.then` and `setTimeout` may differ from the advanced runtime environment, but they will also remain executed in the current context before executing the relevant statements. The `Promise` related methods not mentioned above are not supported, such as `Promise.prototype.finally`. If you use these missing features, you can only implement them yourself or find similar [core js](https://github.com/zloirock/core-js). The library is filled with
|
|
100
|
+
The `Promise` object is also not supported by the IE series of browsers. The `Promise` implemented by `efront` is not consistent with the native features and is only replaced when the runtime environment does not support it. For example, the execution order of methods triggered by `.then` and `setTimeout` may differ from the advanced runtime environment, but they will also remain executed in the current context before executing the relevant statements. The `Promise` related methods not mentioned above are not supported, such as `Promise.prototype.finally`. If you use these missing features, you can only implement them yourself or find similar [core js](https://github.com/zloirock/core-js). The library is filled with
|
|
89
101
|
|
|
90
|
-
|
|
102
|
+
11. ```javascript
|
|
91
103
|
obj.if
|
|
92
104
|
obj.catch
|
|
93
105
|
obj.for
|
|
94
106
|
```
|
|
95
|
-
Similar to this. As the attribute name is the same as the Reserved word of 'js', the browser such as `ie6` will report an error, but you can use it safely in the environment provided by `efront`. Because `efront` itself will process statements that retrieve attributes.
|
|
107
|
+
Similar to this. As the attribute name is the same as the Reserved word of 'js', the browser such as `ie6` will report an error, but you can use it safely in the environment provided by `efront`. Because `efront` itself will process statements that retrieve attributes.
|
|
96
108
|
|
|
97
|
-
|
|
109
|
+
12. There are some features in `IE8` and below browsers that are different from modern 'js' standards, and the components provided by `efront` may not be compatible. When developing applications for such environments, it is important to avoid using them.
|
|
98
110
|
```javascript
|
|
99
111
|
Object.defineProperty(...);
|
|
100
112
|
({
|
|
@@ -106,16 +118,16 @@ Similar to this. As the attribute name is the same as the Reserved word of 'js',
|
|
|
106
118
|
set a(){}
|
|
107
119
|
}
|
|
108
120
|
```
|
|
109
|
-
`IE8` and below browsers do not support `Object.defineProperty` well or at all, and there is currently no compatibility solution for `efront` to implement this type of function. If you want to be compatible with the corresponding environment, please temporarily avoid using related statements and do not use libraries that use these features.
|
|
121
|
+
`IE8` and below browsers do not support `Object.defineProperty` well or at all, and there is currently no compatibility solution for `efront` to implement this type of function. If you want to be compatible with the corresponding environment, please temporarily avoid using related statements and do not use libraries that use these features.
|
|
110
122
|
|
|
111
123
|
```javascript
|
|
112
124
|
Array.prototype.slice.call(objNodeList,...)
|
|
113
125
|
```
|
|
114
|
-
`IE8` and below browsers do not support dom objects such as 'NodeList' to call, and the current `efront` and previously used `typescript` conversion code do not handle this detail. Therefore, do not use high-level syntax such as `[...aaa]`, `{...aaa}` , and `function (...args) {}` in dom operation related statements temporarily to avoid problems with the converted code.
|
|
126
|
+
`IE8` and below browsers do not support dom objects such as 'NodeList' to call, and the current `efront` and previously used `typescript` conversion code do not handle this detail. Therefore, do not use high-level syntax such as `[...aaa]`, `{...aaa}` , and `function (...args) {}` in dom operation related statements temporarily to avoid problems with the converted code.
|
|
115
127
|
|
|
116
128
|
```javascript
|
|
117
129
|
var div = document.createElement("div");
|
|
118
130
|
div.innerHTML = `<abcd><span></span></abcd>`;
|
|
119
131
|
console.log(div.innerHTML); // <SPAN></SPAN>
|
|
120
132
|
```
|
|
121
|
-
`IE8` and below browsers cannot correctly set custom labels through the `innerHTML` attribute, and most of the components provided by `efront` use this feature. In the `efront` example project, [ie8.js](../../apps/kugou/ie8.js) can achieve the adaptation of setting `innerHTML` on `ie8`, but it cannot guarantee the normal style. For browsers under `ie7` and below, do not use the components related to elements provided by `efront` temporarily.
|
|
133
|
+
`IE8` and below browsers cannot correctly set custom labels through the `innerHTML` attribute, and most of the components provided by `efront` use this feature. In the `efront` example project, [ie8.js](../../apps/kugou/ie8.js) can achieve the adaptation of setting `innerHTML` on `ie8`, but it cannot guarantee the normal style. For browsers under `ie7` and below, do not use the components related to elements provided by `efront` temporarily.
|
package/coms/basic_/readme.md
CHANGED
|
@@ -49,8 +49,18 @@
|
|
|
49
49
|
}
|
|
50
50
|
```
|
|
51
51
|
`typescript` 转换这两类新型函数后,`arguments`对象的内容有误。这不是一个难解决的问题,应该只是`typescript`已发现但不愿解决的问题。`efront`在降级编译时临时使用变量重命名的方法对代码中的`arguments`进行替换使其内容与原生高级代码一致。
|
|
52
|
-
|
|
53
52
|
6. ```javascript
|
|
53
|
+
async function(data){
|
|
54
|
+
var reg = /abc/ig,res;
|
|
55
|
+
reg = new RegExp(reg.source, reg.flags) // 如果要并发调用,这里要复制一个新对象
|
|
56
|
+
while(res = reg.exec(data)){
|
|
57
|
+
await ...;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
因为`efront`对正则表达式进行提取,相同的正则表达式,全局只有一个单例对象,如果要并发使用,请在使用前临时复制一个实例。
|
|
62
|
+
|
|
63
|
+
7. ```javascript
|
|
54
64
|
Object.keys
|
|
55
65
|
Object.create
|
|
56
66
|
Array.prototype.map
|
|
@@ -61,7 +71,7 @@
|
|
|
61
71
|
Function.prototype.bind
|
|
62
72
|
```
|
|
63
73
|
以上几个方法`ie9+`系列浏览器已支持,但`ie8`及以下版本不支持,如果没有指定`--no-polyfill`参数`efront`在降级编译期会使用`[]map.js`中提供的方法进行修补,这些方法会在加载器检测到浏览器不支持`[].map`时进行初始化
|
|
64
|
-
|
|
74
|
+
8. ```javascript
|
|
65
75
|
Array.prototype.fill
|
|
66
76
|
Array(3).fill(0) // 类似这种的将变成[0,0,0]一个常量数组
|
|
67
77
|
var [a,b,c]=Array(3).fill(0).map((_,i)=>i+1) // 类似这种用于生成常量并赋值的,将直接变成赋值语句 var a=1,b=2,c=3
|
|
@@ -69,11 +79,11 @@
|
|
|
69
79
|
```
|
|
70
80
|
`Array(...).fill(...).map(...)`这种写法经常被`efront`开发者用来生成自增赋值序列,并且非所有运行环境都支持,所以包括其它显式用到`Array.prototype.fill`的几种写法都会被替换。为了目标代码的性能考虑,这种替换在自动常量化之前就要执行,所以不再支持用`polyfill`的开关进行关闭。如果要关闭,请使用参数`--no-autoeval`将自动常量化的功能一同关闭。
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
9. ```javascript
|
|
73
83
|
Object.assign
|
|
74
84
|
```
|
|
75
85
|
Object.assign,`ie`系列浏览器均不支持,由于经常被`efront`开发者使用,在降级编译期,如果没有指定`--no-polyfill`参数,将由`efront`处理成替代品[extend](../basic/extend.js)
|
|
76
|
-
|
|
86
|
+
10. ```javascript
|
|
77
87
|
Promise
|
|
78
88
|
Promise.prototype.then
|
|
79
89
|
Promise.prototype.catch
|
|
@@ -83,13 +93,13 @@
|
|
|
83
93
|
Promise.resolve
|
|
84
94
|
```
|
|
85
95
|
`Promise`对象也是`ie`系列浏览器均不支持的。`efront`实现的`Promise`与原生的特性并不一致,仅在运行环境不支持的时候进行替代。比如由`.then`触发的方法与`setTimeout`触发的方法执行的先后顺序会与高级的运行环境有所区别,但也会保持在当前语境执行后再执行相关的语句。以上没有提到的`Promise`相关的方法均不支持,如`Promise.prototype.finally`,如果您使用了这些缺失的特性,就只能自己实现或找类似[core-js](https://github.com/zloirock/core-js)的库填充了
|
|
86
|
-
|
|
96
|
+
11. ```javascript
|
|
87
97
|
obj.if
|
|
88
98
|
obj.catch
|
|
89
99
|
obj.for
|
|
90
100
|
```
|
|
91
101
|
类似这种用`.`取属性的语句,由于属性名与`js`的保留字一样,`ie6`等浏览器会报错,但您可以在`efront`提供的环境中放心使用。因为`efront`本身就会把取属性的语句处理掉。
|
|
92
|
-
|
|
102
|
+
12. `ie8`及以下浏览器中存在的一些与现代`js`标准不同的特性,`efront`提供的组件可能不兼容,在为这类环境进行应用开发时,应避免使用。
|
|
93
103
|
```javascript
|
|
94
104
|
Object.defineProperty(...);
|
|
95
105
|
({
|