/src/main/webapp/resources/new/second.js
JavaScript | 32 lines | 29 code | 3 blank | 0 comment | 3 complexity | 56122a18e8d67f7dae53e98dc312126f MD5 | raw file
1(function() {
2 var namespace,
3 __slice = Array.prototype.slice;
4
5 namespace = function(target, name, block) {
6 var item, top, _i, _len, _ref, _ref2;
7 if (arguments.length < 3) {
8 _ref = [(typeof exports !== 'undefined' ? exports : window)].concat(__slice.call(arguments)), target = _ref[0], name = _ref[1], block = _ref[2];
9 }
10 top = target;
11 _ref2 = name.split('.');
12 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
13 item = _ref2[_i];
14 target = target[item] || (target[item] = {});
15 }
16 return block(target, top);
17 };
18
19 namespace("APP", function(exports) {
20 return exports.draw = function() {
21 var canvas, ctx;
22 canvas = document.getElementById("canvas");
23 ctx = canvas.getContext("2d");
24 ctx.beginPath();
25 ctx.arc(Math.random(0, 100) * 500, Math.random(0, 100) * 200, 10, 0, Math.PI * 2, true);
26 ctx.closePath();
27 ctx.fillStyle = '#' + Math.floor(Math.random() * 16777215).toString(16);
28 return ctx.fill();
29 };
30 });
31
32}).call(this);