forked from chhrrr/RAP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
WebContent/demo/mock.plugin/casebox/case1_seajs_jquery_preload.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters