variable_wrapper_utils.js 879 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * DevExtreme (integration/knockout/variable_wrapper_utils.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var ko = require("knockout");
  11. var variableWrapper = require("../../core/utils/variable_wrapper");
  12. variableWrapper.inject({
  13. isWrapped: ko.isObservable,
  14. isWritableWrapped: ko.isWritableObservable,
  15. wrap: ko.observable,
  16. unwrap: function(value) {
  17. if (ko.isObservable(value)) {
  18. return ko.utils.unwrapObservable(value)
  19. }
  20. return this.callBase(value)
  21. },
  22. assign: function(variable, value) {
  23. if (ko.isObservable(variable)) {
  24. variable(value)
  25. } else {
  26. this.callBase(variable, value)
  27. }
  28. }
  29. });