forked from jashkenas/backbone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testBindAll.js
114 lines (70 loc) · 1.75 KB
/
testBindAll.js
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//
var vv = new (Backbone.View.extend({
a: 5,
initialize: function(){
var self = this;
console.log("!");
this.blah.apply({ a: 6}, []);
var mmmmm = new this.blah();
setTimeout(this.blah, 10);
setTimeout(function(){self.blah()}, 500);
//$(document).on('click', this.click);
console.log("---end--");
},
blah: function() {
console.log("should be..... a number:", this.a);
},
click: function() {
//console.log(this.a);
}
}))();
var J = function(){
this.initialize();
};
_.extend(J.prototype, {
initialize: function(){
debugger;
this.self = this;
console.log("!");
self.blah.apply({ a: 6}, []);
var mmmmm = new self.blah();
setTimeout(self.blah, 10);
setTimeout(function(){self.blah()}, 500);
//$(document).on('click', this.click);
console.log("---end--");
},
blah: function() {
console.log("should be..... a number:", self.a);
},
click: function() {
//console.log(this.a);
}
});
new J();
//////
//
var p = Backbone.View.extend({
a: 5,
initialize: function(){
var self = this;
console.log("!");
this.blah.apply({ a: 6}, []);
var mmmmm = new this.blah();
setTimeout(this.blah, 10);
setTimeout(function(){self.blah()}, 500);
//$(document).on('click', this.click);
console.log("---end--");
},
blah: function() {
console.log("should be..... a number:", this.a);
},
click: function() {
//console.log(this.a);
}
});
new p();
c = p.extend({"t": "wee"})
new c();
// This will not work:
x = p.extend({"a": "hahaha"})
new x();