PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/browser/backbone-basics-min.js

https://github.com/joakin/backbone-basics
JavaScript | 33 lines | 8 code | 0 blank | 25 comment | 0 complexity | c1d811df25fed7c7e0a9e6f0ac25775d MD5 | raw file
  1. !function(n,e,r){function i(r,t){if(!e[r]){if(!n[r]){var c=typeof require=="function"&&require;if(!t&&c)return c(r,!0);if(o)return o(r,!0);throw new Error("Cannot find module '"+r+"'")}var s=e[r]={exports:{}};n[r][0].call(s.exports,function(e){var o=n[r][1][e];return i(o?o:e)},s,s.exports)}return e[r].exports}var o=typeof require=="function"&&require;for(var t=0;t<r.length;t++)i(r[t]);return i}({1:[function(n,e,r){!function(){var e=n("./index");if(!window.Basics){window.Basics=e}else{throw new Error("Basics global variable already defined")}}()},{"./index":2}],2:[function(n,e,r){var i={};i.Model=n("./model");i.Collection=n("./collection");i.View=n("./view");i.Fn=n("./fn");e.exports=i;console.log("loaded!")},{"./model":3,"./collection":4,"./view":5,"./fn":6}],3:[function(n,e,r){var i=n("./fn").mixin,o=n("underscore"),t=n("backbone");/*
  2. * Base model for the application.
  3. */
  4. // Provides helper for nested models.
  5. // By setting the property `types` on a model, you can specify which keys
  6. // correspond to complex types, let that be Models, Collections or custom
  7. // types. When parsed from json they will be instantiated with `new`, and
  8. // when asked toJSON they will be parsed by calling a `toJSON` method that
  9. // they have to implement.
  10. e.exports=t.Model.extend({// This function takes a json object and parses its attributes
  11. // instantiating the ones that are present on the this.types attribute with
  12. // the type specified there.
  13. // This function is used on the default this.parse, but exposed just in
  14. // case you need to override parse and/or call it explicitly from
  15. // somewhere.
  16. // It also considers an option called unfold, to specify that it should
  17. // always create the submodels even if the value in the json is empty.
  18. _parseTypes:function(n,e){if(this.types)o.each(this.types,function(r,i){if((e.unfold||n[i])&&!(n[i]instanceof r))n[i]=new r(n[i],e)});return n},// Change the default parse function to parse types as well
  19. parse:function(n,e){return this._parseTypes(n,e)},// This function takes an attributes object and converts its attributes
  20. // that are complex types into JSON by calling a `toJSON` attribute on the
  21. // object (must be implemented, otherwise fail loudly to be noted).
  22. // This function is used on the default this.toJSON, but exposed just in
  23. // case you need to override toJSON and/or call it explicitly from
  24. // somewhere.
  25. _typesToJSON:function(n){if(this.types)o.each(this.types,function(e,r){n[r]=n[r]&&n[r].toJSON()});return n},// Override the default toJSON object so that it converts typed attrs to js
  26. // objects.
  27. toJSON:function(){var n=o.clone(this.attributes);return this._typesToJSON(n)}},{mixin:o.partial(i,this)})},{underscore:7,backbone:8,"./fn":6}],4:[function(n,e,r){var i=n("./fn").mixin,o=n("underscore"),t=n("backbone");/*
  28. * Base Collection
  29. */
  30. e.exports=t.Collection.extend({},{mixin:o.partial(i,this)})},{underscore:7,backbone:8,"./fn":6}],6:[function(n,e,r){var i=n("underscore");var o={};o.mixin=function(n,e){for(var r in e){if(e.hasOwnProperty(r)){var t=e[r];if(i.isObject(t)){t=o.mixin(i.isArray(t)?[]:{},t)}n[r]=t}}return n}},{underscore:7}],5:[function(n,e,r){var i=n("./fn").mixin,o=n("underscore"),t=n("backbone");/*
  31. * Base View
  32. */
  33. e.exports=t.View.extend({},{mixin:o.partial(i,this)})},{underscore:7,backbone:8,"./fn":6}],7:[function(n,e,r){e.exports=window._},{}],8:[function(n,e,r){e.exports=window.Backbone},{}]},{},[1]);