How to use the ember-compatibility-helpers.lte function in ember-compatibility-helpers

To help you get started, we’ve selected a few ember-compatibility-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rwjblue / ember-modifier-manager-polyfill / vendor / ember-modifier-manager-polyfill.js View on Github external
//update(modifier: ModifierInstanceState): void;
        update(state) {
          let { args, delegate, modifier } = state;
          let modifierArgs = valueForCapturedArgs(args);
          delegate.updateModifier(modifier, modifierArgs);
        }

        //getDestructor(modifier: ModifierInstanceState): Option;
        getDestructor(state) {
          return state;
        }
      }

      let Polyfilled_CustomModifierManagerLt36;
      if (lte('3.6.0-alpha.1')) {
        Polyfilled_CustomModifierManagerLt36 = class Polyfilled_CustomModifierManagerLt36 extends Polyfilled_CustomModifierManager {
          constructor(name, ModifierClass, manager) {
            super();

            this.state = {
              ModifierClass,
              delegate: manager,
            };
          }

          // create(element: Simple.Element, args: Arguments, _dynamicScope: DynamicScope, dom: any) {
          create(element, args) {
            return super.create(element, this.state, args);
          }
        };
      }
github nickiaconis / ember-prefetch / addon / initializers / redirect-patch.js View on Github external
export function initialize() {
  if (lte('3.5.1')) {
    // Delete all of this in the Ember 3.8 LTS and rev major
    if (!hasInitialized) {
      hasInitialized = true;

      EmberRouter.reopen({
        _initRouterJs() {
          this._super.apply(this, arguments);

          // now this.router is available
          // router.router renamed to _routerMicrolib in 2.13
          // https://emberjs.com/deprecations/v2.x/#toc_ember-router-router-renamed-to-ember-router-_routermicrolib
          const router = this._routerMicrolib || this.router;
          const emberRouter = this;
          const stack = [];
          let latest = null;
github rwjblue / ember-modifier-manager-polyfill / vendor / ember-modifier-manager-polyfill.js View on Github external
TemplateCompiler.create = function() {
          let compiler = ORIGINAL_TEMPLATE_COMPILER_CREATE(...arguments);
          let compileTimeLookup = compiler.resolver;
          let runtimeResolver = compileTimeLookup.resolver;

          // meta was not passed to `_lookupModifier` until 3.7
          if (lte('3.7.0-alpha.1')) {
            runtimeResolver.lookupModifier = function(name, meta) {
              return this.handle(this._lookupModifier(name, meta));
            };
          }

          runtimeResolver._lookupModifier = function(name, meta) {
            let builtin = this.builtInModifiers[name];

            if (builtin === undefined) {
              let { owner } = meta;
              let modifier = owner.factoryFor(`modifier:${name}`);
              if (modifier !== undefined) {
                let managerFactory = getModifierManager(modifier.class);
                let manager = managerFactory(owner);

                if (gte('3.6.0-alpha.1')) {
github rwjblue / ember-angle-bracket-invocation-polyfill / vendor / angle-bracket-invocation-polyfill / runtime-polyfill.js View on Github external
manager.didCreateElement = function(bucket, element, operations) {
                  ORIGINAL_DID_CREATE_ELEMENT.apply(this, arguments);
                  let { args } = bucket;

                  if (lte('2.15.0-beta.1')) {
                    args = args.namedArgs;
                  }

                  // on < 2.15 `namedArgs` is only present when there were arguments
                  if (args && args.has('__ANGLE_ATTRS__')) {
                    let attributeReferences = args.get('__ANGLE_ATTRS__');
                    let snapshot = attributeReferences.value();
                    if (snapshot) {
                      let names = Object.keys(snapshot);
                      for (let i = 0; i < names.length; i++) {
                        let attributeName = names[i];
                        let attributeReference = attributeReferences.get(attributeName);

                        operations.addDynamicAttribute(
                          element,
                          attributeName,
github rwjblue / ember-modifier-manager-polyfill / vendor / ember-modifier-manager-polyfill.js View on Github external
return builtin;
          };

          return compiler;
        };
        TemplateCompiler.create.__MODIFIER_MANAGER_PATCHED = true;
      } else if (gte('2.12.0-beta.1')) {
        let Environment = registry.resolve('service:-glimmer-environment');
        let ORIGINAL_ENVIRONMENT_CREATE = Environment.create;
        if (ORIGINAL_ENVIRONMENT_CREATE.__MODIFIER_MANAGER_PATCHED === true) {
          return registry;
        }

        let factoryForMethodName = 'factoryFor';
        if (lte('2.13.99999999')) {
          factoryForMethodName = Ember.__loader.require('container').FACTORY_FOR;
        }

        Environment.create = function Polyfilled_EnvironmentCreate() {
          let environment = ORIGINAL_ENVIRONMENT_CREATE.apply(this, arguments);

          environment.hasModifier = function(name, metaOrSymbolTable) {
            let owner = gte('2.15.0-alpha.1')
              ? metaOrSymbolTable.owner
              : metaOrSymbolTable.getMeta().owner;

            return !!this.builtInModifiers[name] || !!owner.hasRegistration(`modifier:${name}`);
          };

          environment.lookupModifier = function(name, metaOrSymbolTable) {
            let modifier = this.builtInModifiers[name];
github rwjblue / ember-angle-bracket-invocation-polyfill / vendor / angle-bracket-invocation-polyfill / runtime-polyfill.js View on Github external
buildRegistry() {
        let registry = this._super(...arguments);

        let factoryForMethodName = 'factoryFor';
        if (lte('2.13.99999999')) {
          factoryForMethodName = Ember.__loader.require('container').FACTORY_FOR;
        }

        registry.register(
          'component-lookup:main',
          Ember.Object.extend({
            componentFor(name, owner, options) {
              let fullName = `component:${name}`;
              return owner[factoryForMethodName](fullName, options);
            },

            layoutFor(name, owner, options) {
              let templateFullName = `template:components/${name}`;
              return owner.lookup(templateFullName, options);
            },
          })

ember-compatibility-helpers

Zero-cost compatibility flags and helpers for Ember.js

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular ember-compatibility-helpers functions