当前位置: 首页 > news >正文

喀什地区网站建设_网站建设公司_网站备案_seo优化

咸阳营销型网站建设,猎聘网网站谁做的,建设工程施工包括哪些工程,果农在哪些网站做推广‎ Table of Contents 1. 全局对象2. 代码执行优先级3. 模块导入4. 模块加载 4.1. 文件模块优先级4.2. 文件夹加载优先级 4.2.1. 包#xff08;文件夹#xff09;下的入口文件优先级4.2.2. 包加载优先级5. 核心模块的简单使用 5.1. events1 全局对象 globalconsole.log(globa…     ‎ Table of Contents 1. 全局对象2. 代码执行优先级3. 模块导入4. 模块加载 4.1. 文件模块优先级4.2. 文件夹加载优先级 4.2.1. 包文件夹下的入口文件优先级4.2.2. 包加载优先级5. 核心模块的简单使用 5.1. events 1 全局对象 global console.log(global);// Object [global] { // global: [Circular], // clearInterval: [Function: clearInterval], // clearTimeout: [Function: clearTimeout], // setInterval: [Function: setInterval], // setTimeout: [Function: setTimeout] { [Symbol(util.promisify.custom)]: [Function] }, // queueMicrotask: [Function: queueMicrotask], // clearImmediate: [Function: clearImmediate], // setImmediate: [Function: setImmediate] { // [Symbol(util.promisify.custom)]: [Function] // } // }console console.log(console)// { // log: [Function: bound consoleCall], // warn: [Function: bound consoleCall], // dir: [Function: bound consoleCall], // time: [Function: bound consoleCall], // timeEnd: [Function: bound consoleCall], // timeLog: [Function: bound consoleCall], // trace: [Function: bound consoleCall], // assert: [Function: bound consoleCall], // clear: [Function: bound consoleCall], // count: [Function: bound consoleCall], // countReset: [Function: bound consoleCall], // group: [Function: bound consoleCall], // groupEnd: [Function: bound consoleCall], // table: [Function: bound consoleCall], // debug: [Function: bound consoleCall], // info: [Function: bound consoleCall], // dirxml: [Function: bound consoleCall], // error: [Function: bound consoleCall], // groupCollapsed: [Function: bound consoleCall], // Console: [Function: Console], // profile: [Function: profile], // profileEnd: [Function: profileEnd], // timeStamp: [Function: timeStamp], // context: [Function: context], // [Symbol(kBindStreamsEager)]: [Function: bound ], // [Symbol(kBindStreamsLazy)]: [Function: bound ], // [Symbol(kBindProperties)]: [Function: bound ], // [Symbol(kWriteToConsole)]: [Function: bound ], // [Symbol(kGetInspectOptions)]: [Function: bound ], // [Symbol(kFormatForStdout)]: [Function: bound ], // [Symbol(kFormatForStderr)]: [Function: bound ] // } exports, require, module, _filename, _dirname模块参数 console.log(arguments.callee );// function (exports, require, module, __filename, __dirname) { // console.log(arguments.callee );2 代码执行优先级 同步代码优先例子如下 // 代码执行优先级 setTimeout(function () {setTimeout(function () {console.log(time out);}, 0);new Promise(resolve {setTimeout(function () {console.log(start in Promise);}, 1);console.log(beg);resolve();console.log(end);setTimeout(function () {console.log(end in Promise);}, 0);}).then(() {console.log(finish);});console.log(不要调皮); }, 100);// beg // end // 不要调皮 // finish // time out // start in Promise // end in Promise3 模块导入 同步导入module.exports exports true { test } » tree . ├── index.js └── test.js./index.js console.log(index.js);./test.js require(./index.js); console.log(test.js);output: 导入之后才会继续执行代码 index.js test.js4 模块加载 4.1 文件模块优先级 这里只考虑 .js .json文件路径加载 文件结构 . ├── a.js ├── a.json ├── b.json └── test.jsa.js module.exports js文件优先;a.json {s: json文件优先 }b.json {main : json 文件也支持省略扩展名的方式加载 }test.js // 测试js文件先加载 console.log(require(./a)); // 证明json也可以加载 console.log(require(./b));output默认文件加载js先于json文件 js文件优先 { main: json 文件也支持省略扩展名的方式加载 }4.2 文件夹加载优先级 4.2.1 包文件夹下的入口文件优先级 文件结构 . ├── a │   ├── index.js │   ├── m.js │   └── package.json ├── b │   ├── index.js │   └── package.json ├── c │   └── index.js └── test.js./aindex.js module.exports index.js文件优先;m.js module.exports package.json文件优先;package.json {name: a,version: 1.0.0,main : m.js }./bindex.js module.exports ./b/index.js文件优先;package.json {name: a,version: 1.0.0 }./cindex.js module.exports index.js支持默认加载;./test.js // 优先加载packagae.json文件 console.log(require(./a)); // packagae.json中main属性指定加载某文件 console.log(require(./b)); // index.js也支持默认加载 console.log(require(./c));output package.json文件中有main优先于index.js文件 package.json文件优先 ./b/index.js文件优先 index.js支持默认加载4.2.2 包加载优先级 路径加载文件结构 . ├── fs │   └── index.js └── test.js./fs/index.js module.exports 路径加载优先级高;./fs/test.js // 加载核心模块 console.log(require(fs)); // 第三方模块 console.log(require(./fs));output路径加载优先级高于核心模块 {appendFile: [Function: appendFile],appendFileSync: [Function: appendFileSync],access: [Function: access],accessSync: [Function: accessSync],chown: [Function: chown],promises: [Getter]..........//还有很多 } 路径加载优先级高非路径加载文件结构 . ├── node_modules │   ├── fs │   │   └── index.js │   └── tts │   └── index.js └── test.js./nodenodules./fs/index.js module.exports ./node_nodules./fs;./nodenodules./tts/index.js module.exports ./node_nodules./tts;./test.js // 判断第三方模块和核心模块的优先级 console.log(require(fs)); // 第三方模块可以加载 console.log(require(tts));output核心模块加载优先于第三方模块(nodemodules) {appendFile: [Function: appendFile],appendFileSync: [Function: appendFileSync],access: [Function: access],......//很多promises: [Getter] } ./node_nodules./tts第三方模块查找过程非路径查找文件结构 . ├── a │   ├── b │   │   ├── c │   │   │   ├── node_modules │   │   │   │   └── tts1 │   │   │   │   └── index.js │   │   │   └── t.js │   │   └── node_modules │   │   └── tts2 │   │   └── index.js │   └── node_modules │   └── tts3 │   └── index.js └── node_modules└── tts4└── index.jsmodule.paths 中列表的顺序查找递归向上级目录查找 [C:\\a\\b\\c\\node_modules,C:\\a\\b\\node_modules,C:\\a\\node_modules,C:\\node_modules ]5 核心模块的简单使用 5.1 events 继承了事件类自身不用实现事件类 const events require(events);class Teacher extends events {constructor(sec 2000) {super();this.sec sec;this.doing();}doing() {let cnt 0;setInterval(() {cnt;this.emit(class, {cnt});}, this.sec);} }const t new Teacher(); t.on(class, function (args) {console.log(time to class:, args.cnt); });Created: 2019-06-26 周三 09:31 Validate 转载于:https://www.cnblogs.com/heidekeyi/p/11075506.html
http://www.lebaoying.cn/news/113746.html

相关文章:

  • 重庆哪里可以做网站的wordpress 免登陆接口
  • crm网站白银市住房和城乡建设厅网站首页
  • 怀柔网站建设推广网站标题在哪里修改
  • 网上购物网站开发的目的青岛企业建设网站企业
  • 移动网站开发面试学做婴儿衣服网站好
  • 调查问卷网站建设方案泰安软件开发公司哪家好
  • 深圳seo优化多少钱邵阳seo优化
  • 天津网站优化公司手表网站查询
  • 北京网站制作哪些网站自己做宣传
  • 电商网站的制作流程建筑装饰公司排名
  • 山西住房和建设厅网站如何做婚庆公司的网站
  • 网站前台和后台对接实例福州百度做网站多少钱
  • 济南专业网站制作免费网站建设模块
  • 徐水网站建设站酷设计网站官网网址
  • 太原网站公司郑州网站设计推荐
  • 天津建设网投标网站重庆网站的网络推广
  • 做网站推广书范法吗网站查询备案服务商
  • 生活做爰网站济南网站建设价格
  • 小说阅读网站开发视频网上图书商城网站设计
  • 公共资源中心网站建设网站及数据库怎么做后门
  • 企业网站哪家好黄骅贴吧最新消息金鼎18号
  • 苏宁易购网站建设的目标价格比较网
  • 网站页面优化工具wordpress获取自定义文章类型分类
  • 做网站人员配置长沙网络科技有限公司
  • 做蛋糕的英文网站建设银行手机官方网站下载
  • 网站建设在哪里学信誉好的东莞网站推广
  • 业余做网站做网站的找哪个
  • 网站百度权重查询网站后台更新怎么做
  • 南京手机网站制作南网站建设 首选搜点网络
  • wordpress 网站暂停跨境电商网站建设主管岗位职责