Hi, Iv got an odd thing happening that causing significant delay on my page loads. Im loading JSON data from my server, how ever every time the page loads, it loads this data three times.
Attached is a screenshot of my console showing the 3 loads when the page
opens.
I can confirm this by loading the page and then watching my web server
console. The first request happens, then about 1 second later another,
followed by another. (Its a rails app, im watching from the rails console)
Id love to know how to stop this happening.
Here's my JS.
var tl;
function loadTimeline() {
var eventSource = new Timeline.DefaultEventSource(0);
// Override all scroll wheel handling to let the browser work as
normal
Timeline._Band.prototype._onMouseScroll = function(innerFrame, evt,
target) {};
var theme = Timeline.ClassicTheme.create();
theme.event.bubble.width = 350;
theme.event.bubble.height = 220;
var d = new Date();
var bandInfos = [
Timeline.createBandInfo({
width: "70%",
intervalUnit: Timeline.DateTime.HOUR,
intervalPixels: 100,
eventSource: eventSource,
date: d,
theme: theme
}),
Timeline.createBandInfo({
width: "30%",
overview: true,
showEventText: false,
trackHeight: 0.5,
trackGap: 0.5,
intervalUnit: Timeline.DateTime.DAY,
intervalPixels: 200,
eventSource: eventSource,
date: d,
theme: theme
})
];
//Sync The Bands
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos,
Timeline.HORIZONTAL);
tl.loadJSON("/accounts/timeline_data/<%= params[:id] %>.json",
function(json, url) {
eventSource.loadJSON(json, url);
});
}
var resizeTimerID = null;
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
--
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/simile-widgets/-/sBmk6ICOtwoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en.
<<attachment: Screen Shot 2012-12-19 at 18.01.27.png>>
