Sha256: f8d9e874cbf1521dd4fad3ebb6752e61da6e4a0105487cbe8752fc708f8a8e83

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

import { assign } from '@ember/polyfills';
import { addObserver } from 'ember-metal';
import EmberError from '@ember/error';
import { DEBUG } from '@glimmer/env';

import hasElement from './has_element';

const inDOM = Object.create(hasElement);

assign(inDOM, {
  enter(view) {
    // Register the view for event handling. This hash is used by
    // Ember.EventDispatcher to dispatch incoming events.
    view.renderer.register(view);

    if (DEBUG) {
      addObserver(view, 'elementId', () => {
        throw new EmberError("Changing a view's elementId after creation is not allowed");
      });
    }
  },

  exit(view) {
    view.renderer.unregister(view);
  },
});

export default inDOM;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-views/lib/views/states/in_dom.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-views/lib/views/states/in_dom.js