Skip to content

Commit 8aab48b

Browse files
author
Wilhelm Eklund
committed
Created simple example with RequireJS.
1 parent 1256705 commit 8aab48b

File tree

9 files changed

+9862
-0
lines changed

9 files changed

+9862
-0
lines changed

js/buttonclicker.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Common config part for all pages
3+
*/
4+
requirejs.config({
5+
baseUrl: 'js/',
6+
paths: {
7+
jquery: 'lib/jquery',
8+
underscore: 'lib/underscore'
9+
}
10+
});
11+
12+
/**
13+
* Start JS for this specific page
14+
*/
15+
requirejs(
16+
['jquery', 'widgets/mywidget'],
17+
function ($, MyWidget) {
18+
// Run when ready
19+
$(function () {
20+
console.info("Running from inside the main program: buttonclicker.js");
21+
//$('body').append("<span style='color:#48AF5E'>Running from inside the function.</span>");
22+
var myWidget = new MyWidget('.menu button', '#date_start', '#date_end');
23+
console.log("myWidget:", myWidget);
24+
});
25+
});
File renamed without changes.

0 commit comments

Comments
 (0)