BaseModel.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  8. (function (Drupal, Backbone) {
  9. Drupal.quickedit.BaseModel = Backbone.Model.extend({
  10. initialize: function initialize(options) {
  11. this.__initialized = true;
  12. return Backbone.Model.prototype.initialize.call(this, options);
  13. },
  14. set: function set(key, val, options) {
  15. if (this.__initialized) {
  16. if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') {
  17. key.validate = true;
  18. } else {
  19. if (!options) {
  20. options = {};
  21. }
  22. options.validate = true;
  23. }
  24. }
  25. return Backbone.Model.prototype.set.call(this, key, val, options);
  26. }
  27. });
  28. })(Drupal, Backbone);