摘要:Module 即模块,来看下RequireJS怎么定义 Module :1. 简单的名值对// Inside file my/shirt.js:define({ color: "black", size: "unisize"});2. 定义成一个Function// my/shirt.js now does setup work// before returning its module definition.define(function () { // Do setup work here return { color: "black&qu
阅读全文
摘要:RequireJS是一个模块加载框架,所以为了最直观的感受它,我们先来看看它的加载系统。先看入口方法:/** * Does the request to load a module for the browser case. * Make this a separate function to allow other environments * to override it. * * @param {Object} context the require context to find state. * @param {String} moduleName the name of the m
阅读全文