Sha256: 2d477069fdab65568e744b35b34733b65a5464528f2d96e6fa68234f4e858465

Contents?: true

Size: 1.41 KB

Versions: 22

Compression:

Stored size: 1.41 KB

Contents

import jQuery from 'jquery';
var requiresDomElement, selection;

requiresDomElement = Object.defineProperty.requiresDomElement;

selection = function(observable) {
  if (requiresDomElement) {
    selection.generate_ignores(observable);
    return selection.legacy;
  } else {
    return selection.from_call;
  }
};

selection.legacy = function() {
  var fix, object;

  object = selection.from_call.apply(this, arguments);
  if (!jQuery.isReady) {
    throw new Error("observable.call: For compatibility reasons, observable can only be called when dom is loaded.");
  }
  if (typeof object.nodeName !== "string") {
    fix = document.createElement("fix");
    document.body.appendChild(fix);
    object = jQuery.extend(fix, object);
  }
  return object;
};

selection.generate_ignores = function(observable) {
  var fix_ignores, ignores, property;

  ignores = document.createElement("fix");
  fix_ignores = [];
  property = void 0;
  for (property in ignores) {
    fix_ignores.push(property);
  }
  return observable.ignores = fix_ignores;
};

selection.from_call = function(param) {
  var object;

  if (this === window) {
    object = param || {};
  } else if (this !== window) {
    if (param) {
      throw new TypeError("Two objects provided! Call either with observable.call(object) or observable(object), not with observable.call(param, param)");
    } else {
      object = this;
    }
  }
  return object;
};

export default selection;

Version data entries

22 entries across 20 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.22 components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.21 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.21 components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.20 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.19 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.18 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.17 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.16 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.15 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.14 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.13 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.12 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.10 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.9 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.8 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.7 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.6 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.5 components/indefinido/observable/es6-modules/lib/observable/selection.js
ende-0.5.4 components/indefinido/observable/es6-modules/lib/observable/selection.js