Ohm-Management - Projektarbeit B-ME
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.

applicationable.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { factory as PositionableFactory } from './positionable';
  2. // Util
  3. import mixins from '../util/mixins';
  4. export default function applicationable(value) {
  5. var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  6. /* @vue/component */
  7. return mixins(PositionableFactory(['absolute', 'fixed'])).extend({
  8. name: 'applicationable',
  9. props: {
  10. app: Boolean
  11. },
  12. computed: {
  13. applicationProperty: function applicationProperty() {
  14. return value;
  15. }
  16. },
  17. watch: {
  18. // If previous value was app
  19. // reset the provided prop
  20. app: function app(x, prev) {
  21. prev ? this.removeApplication(true) : this.callUpdate();
  22. },
  23. applicationProperty: function applicationProperty(newVal, oldVal) {
  24. this.$vuetify.application.unbind(this._uid, oldVal);
  25. }
  26. },
  27. activated: function activated() {
  28. this.callUpdate();
  29. },
  30. created: function created() {
  31. for (var i = 0, length = events.length; i < length; i++) {
  32. this.$watch(events[i], this.callUpdate);
  33. }
  34. this.callUpdate();
  35. },
  36. mounted: function mounted() {
  37. this.callUpdate();
  38. },
  39. deactivated: function deactivated() {
  40. this.removeApplication();
  41. },
  42. destroyed: function destroyed() {
  43. this.removeApplication();
  44. },
  45. methods: {
  46. callUpdate: function callUpdate() {
  47. if (!this.app) return;
  48. this.$vuetify.application.bind(this._uid, this.applicationProperty, this.updateApplication());
  49. },
  50. removeApplication: function removeApplication() {
  51. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  52. if (!force && !this.app) return;
  53. this.$vuetify.application.unbind(this._uid, this.applicationProperty);
  54. },
  55. updateApplication: function updateApplication() {
  56. return 0;
  57. }
  58. }
  59. });
  60. }
  61. //# sourceMappingURL=applicationable.js.map