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.

44 lines
1.1 KiB

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