ChangeModeAction.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['../../../../lib/@waca/core-client/js/core-client/ui/core/Events', '../../../util/EventConstants'], function (Events, EventConstants) {
  8. /**
  9. * Action to toggle between consume and authoring modes
  10. */
  11. var ChangeModeAction = null;
  12. ChangeModeAction = Events.extend({
  13. init: function init(authoredPageView, options) {
  14. ChangeModeAction.inherited('init', this, arguments);
  15. this.name = EventConstants.changeModeAction;
  16. this.sender = options && options.sender;
  17. this.value = authoredPageView.isAuthoringMode;
  18. this.prevValue = !authoredPageView.isAuthoringMode;
  19. this.senderContext = {
  20. applyFn: function (value, sender) {
  21. if (authoredPageView.isAuthoringMode !== value) {
  22. authoredPageView.toggleMode({
  23. sender: sender
  24. });
  25. }
  26. }.bind(this)
  27. };
  28. }
  29. });
  30. return ChangeModeAction;
  31. });
  32. //# sourceMappingURL=ChangeModeAction.js.map