Sha256: 0a83b11372986ce7152ba07eebbdeb364c2ae513589182d982a90e6537061e46

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 Bytes

Contents

import { assign } from '@ember/polyfills';
import _default from './default';
import { join } from '@ember/runloop';
import { flaggedInstrument } from '@ember/instrumentation';

const hasElement = Object.create(_default);

assign(hasElement, {
  rerender(view) {
    view.renderer.rerender(view);
  },

  destroy(view) {
    view.renderer.remove(view);
  },

  // Handle events from `Ember.EventDispatcher`
  handleEvent(view, eventName, event) {
    if (view.has(eventName)) {
      // Handler should be able to re-dispatch events, so we don't
      // preventDefault or stopPropagation.
      return flaggedInstrument(`interaction.${eventName}`, { event, view }, () => {
        return join(view, view.trigger, eventName, event);
      });
    } else {
      return true; // continue event propagation
    }
  },
});

export default hasElement;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/views/lib/views/states/has_element.js
discourse-ember-source-3.5.1.1 dist/es/ember-views/lib/views/states/has_element.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-views/lib/views/states/has_element.js