The js API of Mini App
consists of standard ECMAScript js API and Mini App extension API.
Standard ECMAScript js is only the most basic js. The browser extends window, document, navigator and other objects based on it.
Mini App extends neu objects based on ECMAScript
The js code of Mini App
, the h5 side runs in the browser. For non-h5 terminals (including apps), the Android platform runs in the v8 engine, and the iOS platform runs in the jscore engine that comes with iOS, and neither runs in the browser or webview.
On the non-H5 side, although it does not support the js API of browsers such as window, document, and navigator, it also supports standard ECMAScript.
Be careful not to equate js extension objects in browsers with standard js.
Therefore, the non-H5 side of Mini App also supports standard js, syntax such as if and for, variable types such as strings, numbers, time, Boolean values, arrays, custom objects, and various processing methods. It's just that browser-specific objects such as window, document, and navigator are not supported.
Mini App supports not only most ES6 API, but also await/async of ES7.
For the support of ES6 API, see the following table for details (x
means no support, and no special instructions means support):
String | iOS8 | iOS9 | iOS10 | Android |
---|---|---|---|---|
codePointAt | ||||
includes | ||||
startsWith | ||||
endsWith | ||||
repeat | ||||
String.fromCodePoint |
Array | iOS8 | iOS9 | iOS10 | Android |
---|---|---|---|---|
copyWithin | ||||
find | ||||
findIndex | ||||
fill | ||||
entries | ||||
keys | ||||
values | x | x | ||
includes | x | |||
Array.from | ||||
Array.of |
Number | iOS8 | iOS9 | iOS10 | Android |
---|---|---|---|---|
isFinite | ||||
isNaN | ||||
parseInt | ||||
parseFloat | ||||
isInteger | ||||
EPSILON | ||||
isSafeInteger |
Math | iOS8 | iOS9 | iOS10 | Android |
---|---|---|---|---|
trunc | ||||
sign | ||||
cbrt | ||||
clz32 | ||||
imul | ||||
fround | ||||
hypot | ||||
expm1 | ||||
log1p | ||||
log10 | ||||
log2 | ||||
sinh | ||||
cosh | ||||
tanh | ||||
asinh | ||||
acosh | ||||
atanh |
Object | iOS8 | iOS9 | iOS10 | Android |
---|---|---|---|---|
is | ||||
assign | ||||
getOwnPropertyDescriptor | ||||
keys | ||||
getOwnPropertyNames | ||||
getOwnPropertySymbols |
Other | iOS8 | iOS9 | iOS10 | Android<5 |
---|---|---|---|---|
Symbol | ||||
Set | ||||
Map | ||||
Proxy | x | x | x | |
Reflect | ||||
Promise |
Notice