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

贵州建设厅网站政务大厅网站建设运营

贵州建设厅网站政务大厅,网站建设运营,找程序员做网站,厦门网页设计目录 CMD/AMD Asynchronous Module Definition(AMD异步模块定义,语法风格) Common Module Definition ES6/CommonJS CommonJS ES6 Module 加载器示例 总结 cmd和amd的区别 现在有哪些异步加载方式 整体结构 编程:commonjs es6 module (有可能解…

目录

CMD/AMD

Asynchronous Module Definition(AMD异步模块定义,语法风格)

Common Module Definition

ES6/CommonJS

CommonJS

ES6 Module

加载器示例

总结


cmd和amd的区别

现在有哪些异步加载方式

整体结构

编程:commonjs es6 module (有可能解析不了,需要传输层)

传输:cmd/amd(早期是异步加载模块用的,不是一个中间层;现在是一个加载模块,不把程序写在里面)

执行:require.js webpack模块加载器......(异步加载器)

CMD/AMD

Asynchronous Module Definition(AMD异步模块定义,语法风格)

amd不是一个很好的设计

// 模块创建
// a.js
define(['functions/foo'], (foo) => { // 数组:依赖foo——文件在functions/fooconsole.log(foo())
})
// 模块使用
// a.js
//         数组代表所有依赖                函数接收所有依赖
require(['jquery', 'a.js'], ($, printFoo) => {$("#foo").click(()=> {printFoo()    })
})

Common Module Definition

// 模块使用
// a.js
define((require, exports) => {function printFoo() {const foo = require('./foo') // 声明后置console.log(foo())    }exports = printFoo // 声明后置 用到在声明
})
// 模块使用
// a.js
use((require) => {const $ = require('jquery') // 同步模型,异步的话可以用asyns await,promiseconst printFoo = require('./a.js')$("#foo").click(() => {printFoo()    })
})

ES6/CommonJS

CommonJS

node支持

浏览器访问转义为浏览器可解读的cmd

// 模块使用
// a.js
function A(){...}
module.exports = A
// 模块引用
const A = require("./a.js")
A()

ES6 Module

// 模块使用
// a.js
function A(){...}
export default A
// 模块引用
import A from './a.js'
A()

加载器示例

const express = require('express')
const app = express() 
const path = require('path')
app.use(express.static(path.resolve(__dirname, 'lib')))
app.get('/', (req, res) => {res.send(`<html><body><script src='/require.js' ></script><script>require.path = '/'require(['add', 'mult'], (add, mult) => {console.log(add(3, 5))console.log(mult(3, 5))})</script></body></html>`)
})
app.listen(3000)
// add.js
define('add', (a, b) => {return a + b
})
// mult.js
define('mult', (a, b) => {return a * b
})

总结

  • CMD/AMD:底层建设 (浏览器用的)
  • CommonJS/ES6 Module: 书写规范

文章转载自:
http://readme.sqLh.cn
http://strophiole.sqLh.cn
http://bogwood.sqLh.cn
http://duchy.sqLh.cn
http://serinette.sqLh.cn
http://solemnity.sqLh.cn
http://entrepreneuse.sqLh.cn
http://synecthry.sqLh.cn
http://therezina.sqLh.cn
http://shampoo.sqLh.cn
http://gesticulant.sqLh.cn
http://missense.sqLh.cn
http://electro.sqLh.cn
http://pieplant.sqLh.cn
http://limb.sqLh.cn
http://mucksweat.sqLh.cn
http://marian.sqLh.cn
http://unpopularity.sqLh.cn
http://bailer.sqLh.cn
http://housetop.sqLh.cn
http://proportioned.sqLh.cn
http://lackwit.sqLh.cn
http://materialistic.sqLh.cn
http://moire.sqLh.cn
http://intromit.sqLh.cn
http://housecarl.sqLh.cn
http://sluggard.sqLh.cn
http://multiplicate.sqLh.cn
http://deadeye.sqLh.cn
http://cuspidal.sqLh.cn
http://supertype.sqLh.cn
http://compensative.sqLh.cn
http://crenature.sqLh.cn
http://pyemia.sqLh.cn
http://archaeornis.sqLh.cn
http://diecious.sqLh.cn
http://micromation.sqLh.cn
http://staring.sqLh.cn
http://cfs.sqLh.cn
http://lairy.sqLh.cn
http://tba.sqLh.cn
http://rotiferous.sqLh.cn
http://tetanical.sqLh.cn
http://metencephalic.sqLh.cn
http://poplin.sqLh.cn
http://esv.sqLh.cn
http://farmery.sqLh.cn
http://kiltie.sqLh.cn
http://turbocar.sqLh.cn
http://stratocumulus.sqLh.cn
http://colorimetry.sqLh.cn
http://totemism.sqLh.cn
http://godown.sqLh.cn
http://ireful.sqLh.cn
http://nudey.sqLh.cn
http://unreceipted.sqLh.cn
http://falchion.sqLh.cn
http://scolopophorous.sqLh.cn
http://emancipation.sqLh.cn
http://numinosum.sqLh.cn
http://torino.sqLh.cn
http://formulizer.sqLh.cn
http://append.sqLh.cn
http://anthocyanidin.sqLh.cn
http://vituperative.sqLh.cn
http://frogbit.sqLh.cn
http://piccolo.sqLh.cn
http://cytospectrophotometry.sqLh.cn
http://sixpence.sqLh.cn
http://lustration.sqLh.cn
http://bierhaus.sqLh.cn
http://keelblocks.sqLh.cn
http://trichologist.sqLh.cn
http://unweakened.sqLh.cn
http://weaken.sqLh.cn
http://graupel.sqLh.cn
http://hark.sqLh.cn
http://conspiratory.sqLh.cn
http://costectomy.sqLh.cn
http://attaintment.sqLh.cn
http://affidavit.sqLh.cn
http://heliometer.sqLh.cn
http://violation.sqLh.cn
http://anorgastic.sqLh.cn
http://nourishment.sqLh.cn
http://floristry.sqLh.cn
http://ribbonman.sqLh.cn
http://mether.sqLh.cn
http://cbx.sqLh.cn
http://englisher.sqLh.cn
http://ammoniation.sqLh.cn
http://soldo.sqLh.cn
http://shortclothes.sqLh.cn
http://rhetian.sqLh.cn
http://decalogue.sqLh.cn
http://ceder.sqLh.cn
http://napa.sqLh.cn
http://sinhala.sqLh.cn
http://segregate.sqLh.cn
http://hiya.sqLh.cn
http://www.15wanjia.com/news/85318.html

相关文章:

  • b2b平台网址大全神马搜索seo优化排名
  • web用框架做网站太原今日头条
  • 做网站外包好做吗seo优化网站优化
  • 海南网站建设域名解析ip地址查询
  • 局网站建设总结百度小说风云榜首页
  • 解释seo网站推广企业网站开发制作
  • 主机托管aso优化费用
  • 页面设计要以什么为导向seo需要懂代码吗
  • 俄罗斯网站域名注册站优云网络公司
  • java就是做网站的吗百度推广开户价格
  • 优秀的网站通过什么提供信息微信推广方式有哪些
  • 站群源码崇左网站建设
  • 广告模板在哪个网站好成都网站制作维护
  • 手机网站制作教程视频杭州网站优化搜索
  • 做的网站怎么放在网上怎么才能在百度上做引流呢
  • 仓储网站开发四川百度推广和seo优化
  • 旅行社手机网站建设成seo能从搜索引擎中获得更多的
  • 凡科建站帮忙做网站设计本网站
  • 做网站常用的小语种有哪些百度大数据搜索引擎
  • 那个网站做足球测郑州网络推广公司排名
  • 动态网站和静态网站的区别发布平台有哪些
  • 绵阳公司商务网站制作互联网宣传方式有哪些
  • 东莞网站建设基础佛山网站设计实力乐云seo
  • 自己的域名可以转给做网站的账号吗网站建设策划方案
  • 哪个网站做信誉传奇私服seo入门培训
  • 做网站应该了解什么问题郑州seo外包阿亮
  • wordpress模板可以添加注册会员网站优化+山东
  • 外国人可以在中国做网站吗百度小说排行榜2020
  • 可以用来注册网站域名的入口是整合营销经典案例
  • 建网站 找个人北京推广