You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

  1. /**
  2. * Copyright 2013 Matthieu Moquet
  3. * Copyright 2016-2017 LasLabs Inc.
  4. * License MIT (https://opensource.org/licenses/MIT)
  5. **/
  6. (function() {
  7. 'use strict';
  8. Darkroom.Transformation = Transformation;
  9. function Transformation(options) {
  10. this.options = options;
  11. }
  12. Transformation.prototype = {
  13. applyTransformation: function() { /* no-op */ }
  14. };
  15. // Inspired by Backbone.js extend capability.
  16. Transformation.extend = function(protoProps) {
  17. var parent = this;
  18. var child;
  19. if (protoProps && protoProps.hasOwnProperty('constructor')) {
  20. child = protoProps.constructor;
  21. } else {
  22. child = function() { return parent.apply(this, arguments); };
  23. }
  24. Darkroom.Utils.extend(child, parent);
  25. var Surrogate = function() { this.constructor = child; };
  26. Surrogate.prototype = parent.prototype;
  27. child.prototype = new Surrogate();
  28. if (protoProps) Darkroom.Utils.extend(child.prototype, protoProps);
  29. child.__super__ = parent.prototype;
  30. return child;
  31. };
  32. })();