Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.defaultLayout && !this.layout) {
deprecate(
`Specifying \`defaultLayout\` to ${this} is deprecated. Please use \`layout\` instead.`,
false,
{
id: 'ember-views.component.defaultLayout',
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-component-defaultlayout'
}
);
this.layout = this.defaultLayout;
}
// If in a tagless component, assert that no event handlers are defined
assert(
`You can not define a function that handles DOM events in the \`${this}\` tagless component since it doesn't have any DOM element.`,
this.tagName !== '' || !environment.hasDOM || !(() => {
let eventDispatcher = getOwner(this).lookup('event_dispatcher:main');
let events = (eventDispatcher && eventDispatcher._finalEvents) || {};
for (let key in events) {
let methodName = events[key];
if (typeof this[methodName] === 'function') {
return true; // indicate that the assertion should be triggered
}
}
}
)());
},
reset() {
assert(`Calling reset() on instances of \`Ember.Application\` is not
supported when globals mode is disabled; call \`visit()\` to
create new \`Ember.ApplicationInstance\`s and dispose them
via their \`destroy()\` method instead.`, this._globalsMode && this.autoboot);
var instance = this.__deprecatedInstance__;
this._readinessDeferrals = 1;
this._bootPromise = null;
this._bootResolver = null;
this._booted = false;
function handleReset() {
run(instance, 'destroy');
this._buildDeprecatedInstance();
run.schedule('actions', this, '_bootSync');
}
function createClosureComponentCell(env, originalComponentPath, params, hash, label) {
let componentPath = read(originalComponentPath);
assert(`Component path cannot be null in ${label}`,
!isNone(componentPath));
let newHash = assign(new EmptyObject(), hash);
if (isComponentCell(componentPath)) {
return createNestedClosureComponentCell(componentPath, params, newHash);
} else {
assert(`The component helper cannot be used without a valid component name. You used "${componentPath}" via ${label}`,
isValidComponentPath(env, componentPath));
return createNewClosureComponentCell(env, componentPath, params, newHash);
}
}
setupState(prevState, env, scope, params /*, hash */) {
let name = params[0];
assert(
'The first argument of {{mount}} must be an engine name, e.g. {{mount "chat-engine"}}.',
params.length === 1
);
assert(
'The first argument of {{mount}} must be quoted, e.g. {{mount "chat-engine"}}.',
typeof name === 'string'
);
assert(
'You used `{{mount \'' + name + '\'}}`, but the engine \'' + name + '\' can not be found.',
env.owner.hasRegistration(`engine:${name}`)
);
let engineInstance = env.owner.buildChildEngineInstance(name);
engineInstance.boot();
let state = {
parentView: env.view,
manager: prevState.manager,
controller: lookupEngineController(engineInstance),
childOutletState: childOutletState(name, env)
};
setOwner(state, engineInstance);
advanceReadiness() {
assert('You must call advanceReadiness on an instance of Ember.Application', this instanceof Application);
this._readinessDeferrals--;
if (this._readinessDeferrals === 0) {
run.once(this, this.didBecomeReady);
}
},
export function streamifyClassNameBinding(view, classNameBinding, prefix) {
prefix = prefix || '';
assert('classNameBindings must not have spaces in them. Multiple class name bindings can be provided as elements of an array, e.g. [\'foo\', \':bar\']', classNameBinding.indexOf(' ') === -1);
let parsedPath = parsePropertyPath(classNameBinding);
if (parsedPath.path === '') {
return classStringForValue(
parsedPath.path,
true,
parsedPath.className,
parsedPath.falsyClassName
);
} else {
let pathValue = view.getStream(prefix + parsedPath.path);
return chain(pathValue, () => {
return classStringForValue(
parsedPath.path,
read(pathValue),
parsedPath.className,
parsedPath.falsyClassName
function assertHelper(moduleName, node) {
let paramValue = node.params.length && node.params[0].value;
if (!paramValue) {
return;
} else {
assert(
`Using the \`{{view "string"}}\` helper is removed in 2.0. ${calculateLocationDisplay(moduleName, node.loc)}`,
ENV._ENABLE_LEGACY_VIEW_SUPPORT,
{ id: 'view.helper', until: '2.0.0' }
);
}
}
_assertArrayLike(content) {
assert(`an Ember.CollectionView's content must implement Ember.Array. You passed ${content}`, EmberArray.detect(content));
},
function mutParam(read, stream, internal) {
if (internal) {
if (!isStream(stream)) {
let literal = stream;
stream = new LiteralStream(literal);
}
} else {
assert('You can only pass a path to mut', isStream(stream));
}
if (stream[MUTABLE_REFERENCE]) {
return stream;
}
return new MutStream(stream);
}
setupState(prevState, env, scope, params /*, hash */) {
let name = params[0];
assert(
'The first argument of {{mount}} must be an engine name, e.g. {{mount "chat-engine"}}.',
params.length === 1
);
assert(
'The first argument of {{mount}} must be quoted, e.g. {{mount "chat-engine"}}.',
typeof name === 'string'
);
assert(
'You used `{{mount \'' + name + '\'}}`, but the engine \'' + name + '\' can not be found.',
env.owner.hasRegistration(`engine:${name}`)
);
let engineInstance = env.owner.buildChildEngineInstance(name);
engineInstance.boot();
let state = {
parentView: env.view,
manager: prevState.manager,