当前位置:网站首页>Introduction, installation and use of core JS
Introduction, installation and use of core JS
2022-06-12 12:33:00 【Fashion_ Barry】
Preface
Let me tell you something here core-js The developer of the , It is also the information consulted on the Internet .
core-js The author of : A tough Russian programmer , Name is Dennis · Pushkarev (Denis Pushkarev), My hobby is racing motorcycles .

And in an accident , He is in 60 km/h Driving at a speed of , As a result, he hit two pedestrians , One person died at the scene . According to the law of the Russian Federation , He was sentenced to fixed-term imprisonment 18 Months , deprive 2 Annual driving rights , In addition, a fine shall be imposed 138 All the ruble .

Details address :core-js Author jailed 18 Months ,2600 How to proceed with the open source project downloaded ten thousand times a week ? - IT The home of When the programmer in charge of maintenance went to prison , Who will continue to maintain this self written JavaScript Standard library https://www.ithome.com/0/480/137.htm
One 、core-js What is it ?
1. ECMAScript The rapid growth of and the frequent updating of browsers , Every year, new api , for instance es6 The birth of the period 'Promise' ,'Set' Or is it 'es7' Array provides new methods 'includes' , These newly added 'api' , Just one word "polyfill" 'polyfill( shim / Patch )' Is to use a piece of code provided by the community , Let's work on browsers that are not compatible with some new features , Use this new feature . New features es'api' Convert to one that most modern browsers can support 'api' Patch Collection .
2. Because the official library describes him
2.1. It supports the latest ECMAScript standard
2.2. It supports ECMAScript Standard library proposal
2.3. It supports some WHATWG / W3C standard ( Cross platform or ECMAScript relevant )
2.4. It is modular to the maximum extent : You can just load the functions you want to use
2.5. It does not pollute the global namespace
2.6. It and babel Tight integration : This can optimize core-js Import of
2.7. It is the most common 、 Most popular To JavaScript How to patch the standard library
Two 、core-js Related function packages .

stay 'corejs' Of the project packages In file in 'https://github.com/zloirock/core-js/tree/master/packages', You can see five related packages
1.1. 'core-js' install 'npm install core-js' effect ' Defining the global polyfill'
1.2. 'core-js-pure' install 'npm i core-js-pure' effect ' Provide the environment without pollution polyfill, Equivalent to [email protected]/library'
1.3. 'core-js-compat' install 'npm i core-js-compat' Function maintained according to 'browserslist' Standard gasket requirement data , To help us find ' In line with the target environment ' Of 'polyfills' Demand set
1.4. 'core-js-builder' install 'npm i core-js-builder' The effect can be Node.js Service usage , Build shim packs for different scenarios .
1.5.'core-js-builder' install 'npm i core-js-builder' Action can be combined with 'core-js-compact' as well as 'core-js', And make use of 'webpack ' Ability , Package according to the demand core-js Code
3、 ... and 、 How to use ?
1. install npm The way
// global version
npm install --save [email protected]
// version without global namespace pollution
npm install --save [email protected]
// bundled global version
npm install --save [email protected]2. On demand import or global import
// Import all new proposals api
import "core-js";
// Only stable 'core js' function -es and web standard
import "core-js/stable";
// Only stable ES function
import "core-js/es";
// Import only specified api
import "core-js/features/set";
import "core-js/stable/set";
import "core-js/es/set";3. Use demo
Mainly because IE The browser is not compatible with the new syntax 、api, So we need to use core-js Do compatibility processing , To solve the problem .
// first file:
import 'core-js/modules/es.array.iterator';
import 'core-js/modules/es.object.to-string';
import 'core-js/modules/es.set';
var set = new Set([1, 2, 3]);
// second file:
import 'core-js/modules/es.array.of';
var array = Array.of(1, 2, 3);For more details, you can go to GitHub Reference resources : The address is just above

边栏推荐
- TRON-api-波场转账查询接口-PHP版本-基于ThinkPHP5封装-附带接口文档-20220602版本-接口部署好适用于任何开发语言
- 22年gdcpc广东省赛记录
- [C language] keyword static & Multi file & guessing game
- Advanced chapter of C language -- ten thousand words explanation pointer and qsort function
- Cocktail sort
- [译] Go语言测试进阶版建议与技巧
- Bank layout meta universe: digital collections, digital employees become the main track!
- JS how to get the values of multiple objects in an array
- Click to generate 4-bit random number and verify code setting
- Autolock solves the problem of forgetting to unlock after locking
猜你喜欢

Is yuancosmos a short-term speculation or a future trend?

Reasons for college students' leave

Visio 2019 uses PJ

JS string array converted to numeric array and how to add the numbers in the array

Open source project - (erp+ Hotel + e-commerce) background management system

Invalid date of moment conversion timestamp

Advanced C language -- storage of deep anatomical data in memory (with exercise)

Kdd2022 | edge information enhancement graph transformer

Advanced C language -- storage of floating point in memory

C语言深度解剖篇——关键字&&补充内容
随机推荐
Tron API wave field transfer query interface PHP version package based on thinkphp5 attached interface document 20220602 version deployed interface applicable to any development language
Advantages and disadvantages of single page development and multi page development
Async/await for ES6
Visio 2019 uses PJ
ITK 多阶段配准
vtk 图像序列鼠标交互翻页
golang的channel和条件变量在单生产单消费场景下的性能对比测试
What can LDAP and SSO integration achieve?
For in and object The difference between keys()
宏编译 预处理头 WIN32_LEAN_AND_MEAN
Problems encountered in installing canvas and errors encountered in running the project
itk::Neighborhood获取6邻域、18邻域、26邻域,18/6邻域,26/18邻域
左右案例+小圆点的轮播图+无时间
【Leetcode】79. Word search
JS how to get the values of multiple objects in an array
Records of gdcpc Guangdong Provincial Games in 22 years
sublime_text使用
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference
The advantages of saving pointers when saving objects with vector and the use of reserve
[translation] go references - the go memory model | memory model for Chinese translation of official golang documents
https://github.com/zloirock/core-js/tree/master/packages