Rather than including all of the supported dataset types in the
TimeMap.init() switch statement, it should be easier to plug in new parser
types. One thought about how to do this: Store loaders in an object
attribute of TimeMapDataset, e.g.
TimeMapDataset.loaders = {
// start with basic loader
basic: TimeMapDataset.basicLoader
}
Each loader function would take an object parameter "options", including
data, dataset, preload and transform functions, and the LoadMgr object (or
just the ifLoaded function?). Then each file that defined a new parser
would also define the loader, adding it to the TMD.loaders object.
So instead of the switch statement, we'd just have
loader = TimeMapDataset.loaders[data.type];
loader(options);
This would decouple the loader logic from the init function, making it
easier to add new loaders.
Original issue reported on code.google.com by nick.rab...@gmail.com on 22 May 2009 at 11:14
Original issue reported on code.google.com by
nick.rab...@gmail.com
on 22 May 2009 at 11:14