Commit c749fcc1 authored by missingdays's avatar missingdays

Add randomizer module

parent ce5d0ea3
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script scr="scripts/config.js"></script>
<script data-main="scripts/main" src="scripts/require.js"></script>
<title>Index</title>
</head>
<body>
</body>
</html>
/*
* config.js
* Copyright (C) 2015 missingdays <missingdays@missingdays>
*
* Distributed under terms of the MIT license.
*/
var require = {
baseUrl: 'scripts'
}
/*
* main.js
* Copyright (C) 2015 missingdays <missingdays@missingdays>
*
* Distributed under terms of the MIT license.
*/
require(['scripts/randomizer/main.js'], function(randomizer){
document.write(randomizer() + " is loaded");
});
/*
* main.js
* Copyright (C) 2015 missingdays <missingdays@missingdays>
*
* Distributed under terms of the MIT license.
*/
define(['../../randomizer/module1/main', '../../randomizer/module2/main'], function(module1, module2){
return function() {
if(Math.random() > 0.5) {
return module1.name;
} else {
return module2.name;
}
}
});
/*
* module1.js
* Copyright (C) 2015 missingdays <missingdays@missingdays>
*
* Distributed under terms of the MIT license.
*/
define({
name: 'Module 1'
});
/*
* module2.js
* Copyright (C) 2015 missingdays <missingdays@missingdays>
*
* Distributed under terms of the MIT license.
*/
define({
name: 'Module 2'
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment