Skip to content

Instantly share code, notes, and snippets.

@dexteryy
Last active April 17, 2018 03:00
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save dexteryy/60e0e303e894e44551a3 to your computer and use it in GitHub Desktop.
Save dexteryy/60e0e303e894e44551a3 to your computer and use it in GitHub Desktop.

ECMAScript Features, Support and Shims

ES7 / ES8

  • Object.observe
  • Typed Object / binary data
  • Parallel API / River Trail
  • Concurrency and Distribution / Vat
  • Event streams?
  • Completing classes?
  • SES(SecureEcmaScript)?

ES6

重大进步,无替代,无法shim:

  • Generator (yield)
    • 原生支持: firefox, chrome-experimental, node-harmony
    • 编译器支持:traceur
  • Iterator + for..of
    • 原生支持: firefox
    • 编译器支持:traceur
  • Proxy
    • 原生支持: firefox
  • Reflect
  • Proper Tail Calls

重大进步,可部分替代,可部分shim:

  • Symbol
    • 原生支持: chrome-experimental, node-harmony
  • Map + Set + WeakMap + WeakSet

很有用,可替代,可shim:

有用,可替代,无法shim,原生支持进展慢:

有用,无替代,无法shim:

  • let
    • 原生支持: ie11、firefox, chrome ,node-harmony
  • const
    • 原生支持: ie11, firefox, chrome, safari, node

无新功能的语法糖,可替代,无法shim:

  • Arrows
  • Comprehensions
  • Destructuring
  • Default + Rest + Spread Parameters
  • Enhanced Object Literals(__proto__)
  • Block-level function declaration
  • Template Strings(${name})
  • class

ES5 + ES5.1

原生支持:ie9+(9不支持strict mode)、firefox4+、safari5.1+、chrome7+(19开始支持strict mode), node

很有用,可替代,可shim:

  • Array + String + Object + Date APIs
    • require('mo/lang/es5')支持:
      • Array#forEach / Array#map / Array#filter / Array#reduce / Array#reduceRight / Array#some / Array#every / Array#indexOf / Array#lastIndexOf / Array.isArray
      • String#trim
      • Date.now
      • Object.keys / Object.getPrototypeOf
    • require('mo/lang/es5')不支持:
      • Number#toFixed / String#split / Date.parse / Date#toJSON / Date#toISOString
    • 其他shim:es5-shim
  • JSON

很有用,可部分替代,可部分shim:

有用,无替代,无法shim:

  • Object.defineProperty / Object.defineProperties / Object.seal / Object.freeze / Object.preventExtensions / Object.isSealed / Object.isFrozen / Object.isExtensible / Object.getOwnPropertyDescriptor / Object.getOwnPropertyNames
  • Getter / Setter

无新功能的语法,可替代,无法shim:

  • Strict mode
  • "foobar"[3]
  • { if: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment