当前位置:网站首页>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

边栏推荐
- Point cloud registration -- GICP principle and its application in PCL
- object. Defineproperty basic usage
- ACE配置IPv6, VS静态编译ACE库
- InfluxDB2.x 基准测试工具 - influxdb-comparisons
- MVC mode, encryption, jsonwebtoken
- Deep analysis of advanced pointer -- advanced chapter of C language
- 恭喜Splashtop 荣获2022年 IT Europa “年度垂直应用解决方案”奖
- 【Leetcode】637. Layer average of binary tree
- ITK Examples/RegistrationITKv4/DeformableRegistration
- Imx6 uboot add lvds1 display
猜你喜欢

点云配准--gicp原理与其在pcl中的使用

JS built in object

Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference

JS attribute operation and node operation

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

Rust语言学习

【数据库】navicat --oracle数据库创建

BAT面试&高级进阶,文末领取面试资料

开源项目-(ERP+酒店+电商)后台管理系统

In depth anatomy of C language - key words & supplementary contents
随机推荐
VGG小卷积代替大卷积 VS 深度可分离卷积
Numpy numerical calculation basis
Preliminary study on Regional Simulation of crop model
Pre order, middle order and post order traversal of tree
ACE配置IPv6, VS静态编译ACE库
JS built in object
Rust语言学习
JS将DOM导出为图片的方法
The advantages of saving pointers when saving objects with vector and the use of reserve
Advanced C language -- storage of floating point in memory
Ace configures IPv6, vs statically compiles ace Library
ITK 原图种子点经过roi、降采样后index的变化
[JS] some handwriting functions: deep copy, bind, debounce, etc
JS method of exporting DOM as picture
元宇宙是短炒,还是未来趋势?
Elk construction guide
vant 标签栏+上拉加载+下拉刷新demo van-tabs+van-pull-refresh+van-list demo
JS how to convert a string into an array object
MySQL review
Performance comparison test of channel and condition variables of golang in single production and single consumption scenarios
https://github.com/zloirock/core-js/tree/master/packages