Sha256: 800157e6a80bc12fbb7d9a7d6941984b4ecefee21513a46bcce32a14f40bae73

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

import { assign } from '@ember/polyfills';
import _default from './states/default';
import preRender from './states/pre_render';
import hasElement from './states/has_element';
import inDOM from './states/in_dom';
import destroying from './states/destroying';

export function cloneStates(from) {
  let into = {};

  into._default = {};
  into.preRender = Object.create(into._default);
  into.destroying = Object.create(into._default);
  into.hasElement = Object.create(into._default);
  into.inDOM = Object.create(into.hasElement);

  for (let stateName in from) {
    if (!from.hasOwnProperty(stateName)) {
      continue;
    }
    assign(into[stateName], from[stateName]);
  }

  return into;
}

/*
  Describe how the specified actions should behave in the various
  states that a view can exist in. Possible states:

  * preRender: when a view is first instantiated, and after its
    element was destroyed, it is in the preRender state
  * hasElement: the DOM representation of the view is created,
    and is ready to be inserted
  * inDOM: once a view has been inserted into the DOM it is in
    the inDOM state. A view spends the vast majority of its
    existence in this state.
  * destroyed: once a view has been destroyed (using the destroy
    method), it is in this state. No further actions can be invoked
    on a destroyed view.
*/
export let states = {
  _default,
  preRender,
  inDOM,
  hasElement,
  destroying,
};

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.js
discourse-ember-source-3.5.1.1 dist/es/ember-views/lib/views/states.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-views/lib/views/states.js