PageRenderTime 21ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/overviewer_core/data/js_src/models.js

http://github.com/overviewer/Minecraft-Overviewer
JavaScript | 47 lines | 28 code | 9 blank | 10 comment | 0 complexity | 7c7f7171a5d249db0e137e7101a5f80d MD5 | raw file
  1. overviewer.models = {};
  2. /* WorldModel
  3. * Primarily has a collection of TileSets
  4. */
  5. overviewer.models.WorldModel = Backbone.Model.extend({
  6. initialize: function(attrs) {
  7. attrs.tileSets = new overviewer.models.TileSetCollection();
  8. this.set(attrs);
  9. }
  10. });
  11. /* WorldCollection
  12. * A collection of WorldModels
  13. */
  14. overviewer.models.WorldCollection = Backbone.Collection.extend({
  15. model: overviewer.models.WorldModel
  16. });
  17. /* TileSetModel
  18. */
  19. overviewer.models.TileSetModel = Backbone.Model.extend({
  20. defaults: {
  21. markers: []
  22. },
  23. initialize: function(attrs) {
  24. // this implies that the Worlds collection must be
  25. // initialized before any TIleSetModels are created
  26. attrs.world = overviewer.collections.worlds.get(attrs.world);
  27. this.set(attrs);
  28. }
  29. });
  30. overviewer.models.TileSetCollection = Backbone.Collection.extend({
  31. model: overviewer.models.TileSetModel
  32. });
  33. overviewer.models.GoogleMapModel = Backbone.Model.extend({
  34. initialize: function(attrs) {
  35. attrs.currentWorldView = overviewer.collections.worldViews[0];
  36. this.set(attrs);
  37. }
  38. });