-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
151 lines (95 loc) · 2.91 KB
/
index.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* Created by kimi on 14/12/29.
*/
/**
* Created by kimi on 14/11/10.
*/
var $ = require('jquery');
var AppView = require('./app-view');
//var circlerect= require('./circle_rect');
var bike_collection = require('./js/generator/bike_collection.js');
var tour_collection = require('./js/generator/tour_collection.js');
var air_collection = require('./js/generator/air_collection.js');
var d3 = require('d3');//
var moment = require('moment');
moment().format();
var Backbone = require('backbone');
//var p1 = require('./js/generator/p1.js');
var $ = require('jquery');//
var L = require('leaflet');//
//var _ = require('underscore');//
window.heatmap =function() {
var station = Backbone.Model.extend({
defaults: {
name: ''
}
});
var station_extend = Backbone.Collection.extend({
model: station
});
var station_Collection = new station_extend();
/*
var data1 = d3.json("bike.json", function(error, data) {
//console.log(data.retVal);
data.retVal.forEach(function(d) {
station_Collection.add(new station({
ar:d.ar,
lat:d.lat,
lng:d.lng,
sarea:d.sarea,
sbi:d.sbi,
sna:d.sna,
tot:d.tot
}));
});
//window.appView = new AppView({ collection: station_Collection });
});
*/
//window.appView = new AppView({ collection: station_Collection });
//appView.trigger('customEvent', "someDataHere");
function viewcontrol(a,b,air_data) {
return function(notify) {
//console.log("test got");
//notify(null, new Date().getTime());
window.appView = new AppView({ collection: a,collection2: b,air_data: air_data});
notify(null, "1");
};
}
function trigger_init(bike_data) {
return function(notify) {
//console.log("test got");
console.log(bike_data.get("c7").attributes);
var qq =appView.trigger('customEvent2',bike_data.get("c7").attributes);
notify(null, "1");
};
}
function co(gen) {
var g = gen();
function next(err, data) {
var res;
if(err) {
return g.throw(err);
} else {
res = g.next(data);
}
if(!res.done) {
res.value(next)
}
}
next();
}
function * withYield() {
var bike_data = yield bike_collection(1);
//console.log('Collectiuonm'+a);
var b = yield tour_collection();
//console.log('Tour');
//console.log(b);
var air_data = yield air_collection();
var a1 = yield viewcontrol(bike_data,b,air_data);
//console.log('Collectiuonm'+a);
var a2 = yield trigger_init(bike_data);
//console.log('Collectiuonm'+a);
//var qq =appView.trigger('customEvent2');
}
co(withYield);
};