Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosn committed Jun 19, 2014
1 parent 91f13f2 commit e3372cb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="http://style.aliunicorn.com/js/6v/atom/atom-sc.js"></script>
<script type="text/javascript" src="http://rap.alibaba-inc.com/rap.plugin.js?projectId=306&mode=3"></script>
</head>
<body>
<div class="row row-990 wrapper">
<div id="newFastFeedback" class="fastfeedback-content"></div>
<p>
RAP plugin case1: seajs jquery preload issue.
</p>
<p>LOG:</p>
<pre id="preResult"></pre>
</div>

<script>
// 这里的代码封装到一个脚本中,紧接着RAP插件执行。

!function() {
var oldSeajsUse = seajs.use;
var initialized = false;
seajs.use = function() {
var handler = arguments[arguments.length - 1];
arguments[arguments.length - 1] = function() {
if (!initialized) {
wrapJQueryForRAP(arguments[0]);
initialized = true;
}
handler.apply(this, arguments);
};
oldSeajsUse.apply(seajs, arguments);
}
}();

</script>
<script>
function log() {
var ele = document.getElementById('preResult');
ele.innerHTML += [].join.call(arguments, ': ') + "\n";
}


seajs.use('$',function($){

$.ajax({
dataType: 'jsonp',
url: 'http://cn.message.alibaba.com/msgsend/productInfo.htm',
data: {sourceID:'1907157359'},
success: function(result){
console.info(result);
log('result:', JSON.stringify(result, null, 4));
}
});
});
</script>
</body>
</html>
9 changes: 0 additions & 9 deletions WebContent/stat/js/util/mock.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,6 @@
}

if (window.seajs && window.define && window.define.cmd) {
// 删除已经加载的jquery缓存
var cache = seajs.cache || {};
for(var prop in cache) {
prop = prop.toLowerCase();
if (prop.indexOf('jquery') != -1) {
delete cache[prop];
}
}

var data = seajs.config().data;
data.alias = data.alias || {};
var path = 'http://' + ROOT + '/stat/js/util/jquery-rapped.js';
Expand Down

0 comments on commit e3372cb

Please sign in to comment.