Skip to content

Commit

Permalink
First commit with updated example
Browse files Browse the repository at this point in the history
  • Loading branch information
derek committed Oct 10, 2011
1 parent 711846d commit b829327
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 44 deletions.
2 changes: 1 addition & 1 deletion UseYUI.js → YUI.js
Expand Up @@ -31,7 +31,7 @@ define(
"use strict"; "use strict";
// because it's easier then typeof, and undefined isn't allowed in ES5 // because it's easier then typeof, and undefined isn't allowed in ES5
var notDefined, Y, var notDefined, Y,
defaultSrc = 'yui-min.js'; defaultSrc = 'yui-min-341.js';


function loadModule(name, load) { function loadModule(name, load) {
// split the name into an array, with modules that YUI.use // split the name into an array, with modules that YUI.use
Expand Down
31 changes: 31 additions & 0 deletions require-0.27.1.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 27 additions & 43 deletions test.html
@@ -1,50 +1,34 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<div id="someNode"></div> <script src="http://yuim.in/"></script>
<script src="require-0.27.1.js"></script>
<script>

console.log('there are 5 tests');
require(['YUI!dd,anim', 'YUI!cookie'], function (A, B, C) {
var a = new A.Anim();
console.log("Test 1: " + (typeof A.Anim !== 'undefined' ? 'passed' : 'failed' ));
console.log("Test 2: " + (typeof A.Cookie === 'undefined' ? 'passed' : 'failed' ));
// console.log(A);
console.log("Test 3: " + (typeof B.Cookie !== 'undefined' ? 'passed' : 'failed' ));
console.log(C); //undefined
}
);


<script src="require-0.27.1.js"></script> require(['YUI!yql'], function (Y) {
<script> console.log("Test 4: " + (typeof Y.YQL !== 'undefined' ? 'passed' : 'failed' ));
if (typeof console == 'undefined') { });
console = {
log : function (d) {
document.getElementById('someNode').innerHTML += d;
}
};
}


console.log('there are 5 tests'); require({YUI : { src : 'yui-min-341.js'}}, ['YUI!cookie'], function (Y) {
require({ console.log("Test 5: " + (typeof Y.Cookie !== 'undefined' ? 'passed' : 'failed' ));
YUI : { console.log("Test 6: " + (typeof Y.YQL === 'undefined' ? 'passed' : 'failed' ));
src : 'yui-min.js', console.log(Y);
timeout : 1000 });
}
}, require(['YUI!foobar'], function (Y) {
['UseYUI!dd,anim', //This will throw 'NOT loaded' warnings in the console.
'UseYUI!cookie'], function (Y, X) { });
var a = new Y.Anim(); </script>
console.log((typeof Y.Anim !== 'undefined' ? 'passed' : 'failed' ) +
' test 1');
console.log((typeof Y.Cookie === 'undefined' ? 'passed' : 'failed' ) +
' test 2');
console.log((typeof X.Cookie !== 'undefined' ? 'passed' : 'failed' ) +
' test 3');
});

require(
['UseYUI!cookie'], function (Y)
{
console.log((typeof Y.Cookie !== 'undefined' ? 'passed' : 'failed' ) +
' test 4');
});

require(
{ YUI : 'yui-min.js'},
['UseYUI!cookie'], function (Y)
{
console.log((typeof Y.Cookie !== 'undefined' ? 'passed' : 'failed' ) +
' test 5');
});
</script>
</body> </body>
</html> </html>

0 comments on commit b829327

Please sign in to comment.