Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//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);
}
};
}
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;
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')) {
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,
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];
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);
},
})