Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async loadContent() {
kernel_1.Reporter.write(10000, 'Viewport loadContent', this.name);
// No need to wait for next component activation
if (this.content.componentInstance && !this.nextContent.componentInstance) {
await this.content.leave(this.nextContent.instruction);
await this.unloadContent();
}
if (this.nextContent.componentInstance) {
if (this.content.componentInstance !== this.nextContent.componentInstance) {
this.nextContent.addComponent(this.element);
}
else {
this.connectedScope.reenableReplacedChildren();
}
// Only when next component activation is done
if (this.content.componentInstance) {
await this.content.leave(this.nextContent.instruction);
if (!this.content.reentry && this.content.componentInstance !== this.nextContent.componentInstance) {
if (descriptor.configurable === false) {
return dirtyChecker.createProperty(instance, propertyName);
}
if (descriptor.get != null) {
const { constructor: { prototype: { computed: givenOverrides } } } = instance;
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-unnecessary-type-assertion
const overrides = givenOverrides && givenOverrides[propertyName] || computedOverrideDefaults;
if (descriptor.set != null) {
if (overrides.volatile) {
return new GetterObserver(flags, overrides, instance, propertyName, descriptor, observerLocator);
}
return new CustomSetterObserver(instance, propertyName, descriptor);
}
return new GetterObserver(flags, overrides, instance, propertyName, descriptor, observerLocator);
}
throw kernel_1.Reporter.error(18, propertyName);
}
exports.createComputedObserver = createComputedObserver;
connect(flags, scope, binding, part) {
if (scope == null) {
throw kernel_1.Reporter.error(250 /* NilScope */, this);
}
if (!binding) {
throw kernel_1.Reporter.error(206 /* NoBinding */, this);
}
const locator = binding.locator;
if (!locator) {
throw kernel_1.Reporter.error(202 /* NoLocator */, this);
}
this.expression.connect(flags, scope, binding, part);
const args = this.args;
for (let i = 0, ii = args.length; i < ii; ++i) {
args[i].connect(flags, scope, binding, part);
}
const converter = locator.get(this.converterKey);
if (!converter) {
throw kernel_1.Reporter.error(205 /* NoConverterFound */, this);
}
const signals = converter.signals;
if (signals === void 0) {
convertToRenderLocation(node) {
if (this.isRenderLocation(node)) {
return node; // it's already a IRenderLocation (converted by FragmentNodeSequence)
}
if (node.parentNode == null) {
throw kernel_1.Reporter.error(52);
}
const locationEnd = this.document.createComment('au-end');
const locationStart = this.document.createComment('au-start');
node.parentNode.replaceChild(locationEnd, node);
locationEnd.parentNode.insertBefore(locationStart, locationEnd);
locationEnd.$start = locationStart;
locationStart.$nodes = null;
return locationEnd;
}
createDocumentFragment(markupOrNode) {
resolve(handler, requestor) {
const factory = this.factory;
if (factory === null) { // unmet precondition: call prepare
throw kernel_1.Reporter.error(50); // TODO: organize error codes
}
if (typeof factory.name !== 'string' || factory.name.length === 0) { // unmet invariant: factory must have a name
throw kernel_1.Reporter.error(51); // TODO: organize error codes
}
return factory.resolve(requestor);
}
dispose() {
* IsValidAssignmentTarget
* 1,3,4,5,6,7 = false
* 2 = true
*/
primary: switch (state.currentToken) {
case 3077 /* ParentScope */: // $parent
state.assignable = false;
do {
nextToken(state);
access++; // ancestor
if (consumeOpt(state, 16392 /* Dot */)) {
if (state.currentToken === 16392 /* Dot */) {
throw kernel_1.Reporter.error(102 /* DoubleDot */, { state });
}
else if (state.currentToken === 1572864 /* EOF */) {
throw kernel_1.Reporter.error(105 /* ExpectedIdentifier */, { state });
}
}
else if (state.currentToken & 524288 /* AccessScopeTerminal */) {
const ancestor = access & 511 /* Ancestor */;
result = ancestor === 0 ? $this : ancestor === 1 ? $parent : new runtime_1.AccessThisExpression(ancestor);
access = 512 /* This */;
break primary;
}
else {
throw kernel_1.Reporter.error(103 /* InvalidMemberExpression */, { state });
}
} while (state.currentToken === 3077 /* ParentScope */);
// falls through
case 1024 /* Identifier */: // identifier
if (bindingType & 512 /* IsIterator */) {
result = new runtime_1.BindingIdentifier(state.tokenValue);
static fromParent(flags, ps, bc) {
if (ps == null) {
throw kernel_1.Reporter.error(253 /* NilParentScope */);
}
return new Scope(ps, bc, OverrideContext.create(flags, bc, ps.overrideContext));
}
}
render(flags, dom, context, renderable, targets, definition, host, parts) {
const targetInstructions = definition.instructions;
const instructionRenderers = this.instructionRenderers;
if (targets.length !== targetInstructions.length) {
if (targets.length > targetInstructions.length) {
throw kernel_1.Reporter.error(30);
}
else {
throw kernel_1.Reporter.error(31);
}
}
let instructions;
let target;
let current;
for (let i = 0, ii = targets.length; i < ii; ++i) {
instructions = targetInstructions[i];
target = targets[i];
for (let j = 0, jj = instructions.length; j < jj; ++j) {
current = instructions[j];
instructionRenderers[current.type](flags, dom, context, renderable, target, current, parts);
}
}
invokeCallback(entry, navigationFlags, previousEntry) {
const instruction = { ...entry };
instruction.navigation = navigationFlags;
instruction.previous = this.toStoredEntry(previousEntry);
kernel_1.Reporter.write(10000, 'callback', instruction, instruction.previous, this.entries);
if (this.options.callback) {
this.options.callback(instruction);
}
}
toStoreableEntry(entry) {
createObserversLookup(obj) {
const value = {};
if (!Reflect.defineProperty(obj, '$observers', {
enumerable: false,
configurable: false,
writable: false,
value: value
})) {
kernel_1.Reporter.write(0, obj);
}
return value;
}
getAdapterObserver(flags, obj, propertyName, descriptor) {