转: seajs手册与文档之 -- 快速参考 ( ~~useful )
快速参考
该页面列举了 SeaJS 中的常用 API。只要掌握这些方法,就可以娴熟地进行模块化开发。
seajs.use seajs.use
seajs.use('./a');
seajs.use('./a', function(a) {
a.doSomething();
});
seajs.use(['./a', './b'], function(a, b) {
a.doSomething();
b.doSomething();
});
seajs.config seajs.config
seajs.config({
alias: {
'es5-safe': 'es5-safe/0.9.2/es5-safe',
'json': 'json/1.0.1/json',
'jquery': 'jquery/1.7.1/jquery'
},
preload: [
Function.prototype.bind ? '' : 'es5-safe',
this.JSON ? '' : 'json'
]
});
define define
define(function(require, exports, module) {
// The module code goes here
});
require require
define(function(require) {
var a = require('./a');
a.doSomething();
});
require.async require.async
define(function(require, exports, module) {
// load one module
require.async('./b', function(b) {
b.doSomething();
});
// load multiple modules
require.async(['./c', './d'], function(c, d) {
// do something
});
});
exports exports
define(function(require, exports) {
// snip...
exports.foo = 'bar';
exports.doSomething = function() {};
});
module.exports module.exports
define(function(require, exports, module) {
// snip...
module.exports = {
name: 'a',
doSomething: function() {};
};
});
转: seajs手册与文档之 -- 快速参考 ( ~~useful )的更多相关文章
- 转: seajs手册与文档之 -- 配置选项
config alias preload debug map base charset timeout noConflict config 可以使用 config 方法来配置seajs. seajs. ...
- 转: seajs手册与文档之 -- require规则
require 规则 正确拼写 不要修改 使用直接量 动态依赖的小提示 书写规则 使用 SeaJS 书写模块代码时,需要遵循一些简单规则: 1. 正确拼写 在模块代码中,第一个参数 必须 命名为 re ...
- 转: seajs手册与文档之 -- 模块标识
目录 模块标识 相对标识 顶级标识 普通路径 文件后缀的提示 模块标识 模块标识是一个字符串,用来标识模块.在 require. require.async 等加载函数中,第一个参数都是模块标识.de ...
- 转: seajs手册与文档之--模块定义
模块定义 define id dependencies factory exports require require.async require.resolve require.load requi ...
- [Swift通天遁地]七、数据与安全-(2)对XML和HTML文档的快速解析
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 空间日志编辑器:word文档图文快速粘贴到web
百度ueditor可以实现word文档图文快速粘贴到web 1.4.2之后官方并没有做功能的改动,1.4.2在word复制这块没有bug,其他版本会出现手动无法转存的情况 本文使用的后台是Java.前 ...
- Sea.js 手册与文档
Sea.js 手册与文档 首页 | 索引 目录 何为 CommonJS 何为 CommonJS 模块 为何封装模块 何为 CommonJS? CommonJS 是一个有志于构建 JavaScript ...
- Seajs教程 配置文档
seajs.config Obj alias Obj 别名配置,配置之后可在模块中使用require调用require('jQuery'); seajs.config({ alias:{ 'jquer ...
- 【数据库】6.0 MySQL入门学习(六)——MySQL启动与停止、官方手册、文档查询
1.0 MySQL主要有四种启动方式:直接启动.安全启动.服务启动.多实例启动. 直接启动: 服务器启动: 安全启动(最常用): 多实例启动: 2.0如何获得MySQL帮助 2.1官方手册 下面提供百 ...
随机推荐
- Please ensure that adb is correctly located at '...adb.exe' and can be executed.
Android Launch! The connection to adb is down, and a severe error has occured. You must restart adb ...
- CCTableView 简单样例
非常像android中的listview #pragma once; #include "cocos2d.h" using namespace cocos2d; //使用CCTab ...
- 简单使用SimpleCursorAdapter
http://my.oschina.net/javaeye/blog/14846 果使用Sqlite,建议和ContentProvider结合使用.这样数据库的生命周期就不用自己管了.然后,如果要在比 ...
- unity3d插件Daikon Forge GUI 中文教程-5-高级控件listbox和progress bar的使用
(游戏蛮牛首发)大家好我是孙广东.官网提供了专业的视频教程http://www.daikonforge.com/dfgui/tutorials/,只是是在youtube上,要观看是须要FQ的. 只是教 ...
- POJ_1698_Alice's Chance
#include <iostream> #include <queue> #include <climits> #include <cstring> u ...
- 详解H3C交换机“端口安全”功能
以下内容摘自正在全面热销的最新网络设备图书“豪华四件套”之一——<H3C交换机配置与管理完全手册>(第二版)(其余三本分别是:<Cisco交换机配置与管理完全手册>(第二版). ...
- PHP创建定义数组
$array = array(); $array["key"] = "values"; ?> 在PHP中声明数组的方式主要有两种:1.用arr ...
- PHP的一些函数
//进制转换类 base_convert //字符转十六进制 binhex
- windows下安装MySQLdb模块
从http://www.codegood.com/downloads 下载mysqldb相应的exe文件直接安装. 我用的是MySQL-python-1.2.3.win32-py2.7.exe
- [LeetCode]题解(python):003-Longest Substring Without Repeating Characters
题目来源: https://leetcode.com/problems/longest-substring-without-repeating-characters/ 题意分析: 题目是要求出最长的不 ...