Mini Program Javascript Engine

Running Engine

Mini program JavaScript codes fall into logic layer script and sjs script, which run on different threads in the the same JavaScript engine. Mini Program JavaScript Engine is different on different OSs. On the iOS platform, the script runs on the JavaScriptCore provided by the operating system. On the Android platform, the script runs on the V8 engine .

Mini program performs the babel   conversion for the codes uploaded by the developers, so that the JavaScript engine supports most of the ES6 new features. For the internal object of the ES6 extension, Mini Program does not provide polyfill on the JavaScript engine, which causes difference on the supports for different ES6 extension internal objects for the JavaScript on different platforms. the developers need to avoid using the internal objects unsupported by JavaScript engine, and can provide polyfill for the internal objects. (Polyfill means the unsupported raw API codes that are used to implement browsers or other JavaScript engines, such as babel-polyfill)

Supports of Client OSs for ES6 Extension Internal Objects

The table below lists the OS supports for ES6 extension internal objects.

ObjectiOS 9iOS 10 and aboveAndroid
Object.isSupportSupportSupport
Object.assignSupportSupportSupport
Object.keysSupportSupportSupport
Object.getOwnPropertyDescriptorSupportSupportSupport
Object.getOwnPropertyNamesSupportSupportSupport
Object.getOwnPropertySymbolsSupportSupportSupport
StringiOS 9iOS 10 and aboveAndroid
String.prototype.codePointAtSupportSupportSupport
String.prototype.normalizeNo supportSupportSupport
String.prototype.includesSupportSupportSupport
String.prototype.startsWithSupportSupportSupport
String.prototype.endsWithSupportSupportSupport
String.prototype.repeatSupportSupportSupport
String.fromCodePointSupportSupportSupport
ArrayiOS 9iOS 10 and aboveAndroid
Array.prototype.copyWithinSupportSupportSupport
Array.prototype.findSupportSupportSupport
Array.prototype.findIndexSupportSupportSupport
Array.prototype.findSupportSupportSupport
Array.prototype.entriesSupportSupportSupport
Array.prototype.keysSupportSupportSupport
Array.prototype.valuesSupportSupportNo support
Array.prototype.includesSupportSupportSupport
Array.fromSupportSupportSupport
Array.ofSupportSupportSupport
NumberiOS 9iOS 10 and aboveAndroid
Number.isFiniteSupportSupportSupport
Number.isNaNSupportSupportSupport
Number.parseIntSupportSupportSupport
Number.parseFloatSupportSupportSupport
Number.isIntegerSupportSupportSupport
Number.EPSILONSupportSupportSupport
Number.isSafeIntegerSupportSupportSupport
MathiOS 9iOS 10 and aboveAndroid
Math.truncSupportSupportSupport
Math.signSupportSupportSupport
Math.cbrtSupportSupportSupport
Math.clz32SupportSupportSupport
Math.imulSupportSupportSupport
Math.froundSupportSupportSupport
Math.hypotSupportSupportSupport
Math.expm1SupportSupportSupport
Math.log1pSupportSupportSupport
Math.log10SupportSupportSupport
Math.log2SupportSupportSupport
Math.sinhSupportSupportSupport
Math.coshSupportSupportSupport
Math.tanhSupportSupportSupport
Math.asinhSupportSupportSupport
Math.acoshSupportSupportSupport
Math.atanhSupportSupportSupport
Internal objectsiOS 9iOS 10 and aboveAndroid
SetSupportSupportSupport
MapSupportSupportSupport
ProxyNo supportSupportSupport
ReflectSupportSupportSupport
PromiseSupportSupportSupport

Limitations on Dynamic Execution Script

For sake of security, Mini Program limits some of the syntax and APIs of ES.

  • It does not support eval using
  • setTimeout and setInterval functions, and supports only the function for callback parameters. Dynamic execution of codes is not supported.
  • It does not support using new Function to create a function.

Reserved Words of Module Name

The logic layer of Mini Program supports the ES2015 module syntax but regards some internal object names (such as window and document) of browser as the reserved words for emergency needs in the future. Those reserved words cannot be used as the module name. The reserved words include globalThis, global, AlipayJSBridge, fetch, self, window, document, location and XMLHttpRequest. For more details, see the descriptions of module name reserved words in framework description.