forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
79 lines (58 loc) · 1.31 KB
/
Copy pathtest.php
File metadata and controls
79 lines (58 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE HTML>
<html>
<head>
<title>phaser.js - a new beginning</title>
</head>
<body>
<script type="text/javascript">
var BigGame = function(context) {
console.log(context);
console.log(context['hello']);
// this.pendingCallback = callback;
this.pendingCallback = context['hello'];
var _this = this;
this._onLoop = function () {
return _this.boot();
}
if (document.readyState === 'complete' || document.readyState === 'interactive')
{
window.setTimeout(this._onLoop, 0);
}
else
{
document.addEventListener('DOMContentLoaded', this._onLoop, false);
window.addEventListener('load', this._onLoop, false);
}
};
BigGame.prototype = {
isBooted: false,
pendingCallback: null,
_onLoop: null,
boot: function () {
if (this.isBooted) {
return;
}
else
{
document.removeEventListener('DOMContentLoaded', this._onLoop);
window.removeEventListener('load', this._onLoop);
this.pendingCallback();
}
},
check: function () {
console.log(Math.random());
}
};
(function () {
// because this is in a closure we have to pass a reference to the function directly, it can't guess it
// var bob = new BigGame(hello);
//var bob = new BigGame(this);
function hello() {
console.log('hello world 2');
console.log(bob);
bob.check();
}
})();
</script>
</body>
</html>