随笔分类 -  SeaJS

摘要:闭包的英文单词是closure,这是JavaScript中非常重要的一部分知识,因为使用闭包可以大大减少我们的代码量,使我们的代码看上去更加清晰等等,总之功能十分强大。闭包的含义:闭包说白了就是函数的嵌套,内层的函数可以使用外层函数的所有变量,即使外层函数已经执行完毕(这点涉及JavaScript作用域链)。 function fn(){ var str = 'hello'; setTimeout( function(){ alert(str); } //这是一个匿名函数 ... 阅读全文
posted @ 2013-03-14 15:48 microsoftzhcn 阅读(212) 评论(0) 推荐(0)
摘要:<script src="../js/seajs/dist/sea.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8" > //定义 define(function(require, exports) { return { msg:'hello world' } }); //调用 seajs.use('cons', functi... 阅读全文
posted @ 2013-03-14 09:59 microsoftzhcn 阅读(930) 评论(0) 推荐(0)
摘要:拥抱模块化的JavaScripthttp://www.cnblogs.com/snandy/archive/2012/03/07/2378432.html 阅读全文
posted @ 2012-09-17 19:14 microsoftzhcn 阅读(252) 评论(0) 推荐(0)
摘要:目录 模块定义 define id dependencies factory exports require require.async require.resolve require.load require.constructor module module.id module.dependencies module.exports module.constructor seajs.config aliasjquery.js与sea.js综合使用简介:SeaJS:javascrīpt模块化开发jQuery:javas... 阅读全文
posted @ 2012-09-17 16:58 microsoftzhcn 阅读(11033) 评论(1) 推荐(0)
摘要:理论上可以直接升级,除非有用到以下特性:data-main 的路径解析规则发生变化,从 1.2.0 开始调整为与 seajs.use 保持一致,即 data-main="init" 等价 seajs.use("init"). 因此使用 1.1.0 的项目中如果有 data-main="xxx" 的,需要调整为 data-main="./xxx" 。请参考: #217noConflict 方法移除。如果需要用到,可以自己修改下 sea.js 源码,将命名空间改成自己的。去掉该方法,是因为该方法的使用频率极低。prel 阅读全文
posted @ 2012-09-17 15:19 microsoftzhcn 阅读(252) 评论(0) 推荐(0)
摘要:使用SeaJS实现模块化JavaScript开发http://www.cnblogs.com/leoo2sk/archive/2011/06/27/write-javascript-with-seajs.html 阅读全文
posted @ 2012-09-17 13:39 microsoftzhcn 阅读(225) 评论(0) 推荐(0)
摘要:1、定义模块<在JS中定义>define('./dom', [], function(require, exports, module) { var mod; return mod = { 'a' : function() { alert('a'); }, 'b' : function() { alert(... 阅读全文
posted @ 2012-09-17 13:33 microsoftzhcn 阅读(319) 评论(0) 推荐(0)