Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
aurelia-v2-virtual-repeat
Advanced tools
A plugin for doing virtualization with Aurelia 2
Size:
To install the plugin, do:
npm install aurelia-v2-virtual-repeat
To register the standard behavior of the plugin in your application, add DefaultVirtualRepeatConfiguration
to your Aurelia instance:
import { DefaultVirtualRepeatConfiguration } from 'aurelia-v2-virtual-repeat';
Aurelia.register(DefaultVirtualRepeatConfiguration).app(MyApp).start();
This plugin can be used like the standard repeater, like in the following example:
<template>
<div virtual-repeat.for="item of items">
${$index} ${item}
</div>
</template>
<template>
<table>
<tr virtual-repeat.for="item of items">
<td>${$index}</td>
<td>${item}</td>
</tr>
</table>
</template>
<template>
<ul>
<li virtual-repeat.for="item of items">
${$index} ${item}
</li>
</ul>
</template>
The virtual-repeat
requires to be placed inside a "scrollable" element, which means the element should have either overflow: scroll
or overflow: auto
in its styles. An error will be throw if the virtual-repeat
is unable to locate such element.
virtual-repeat
: DOM recycling mode. In this mode, it is expected that the DOM nodes will be moved around, and only binding data will be changed. Application should be aware of this and employ reactive programming model with change handler xxxxxChanged()
to avoid surprises.<template/>
is not supported as a root of a repeat template, use a normal element instead:nth-child
and similar CSS selectors. This implementation requires appropriate shifting visible items, based on scroll position. This means DOM elements order will not stay the same, thus creating unexpected :nth-child
CSS selector behavior. To work around this, you can use contextual properties $index
, $odd
, $even
, $first
, $last
, $middle
, $length
to determine the position of an item, and apply CSS classes/styles against it, like the following example:
<template>
<div virtual-repeat.for="person of persons" class="${$odd ? 'odd' : 'even'}-row">
${person.name}
</div>
</template>
virtual-repeat
, unlike the standard repeat
. I.e: built-in template controllers: with
, if
, au-slot
cannot be used with the virtual-repeat
. This can be workaround'd by nesting other template controllers inside the repeated element, with <template/>
element, for example:
<template>
<h1>${message}</h1>
<div virtual-repeat.for="person of persons">
<template with.bind="person">
Person name is: ${name}
</template>
</div>
</template>
To develop the plugin, run
npm run test
Run unit tests in watch mode.
npm run test:watch
virtual-repeat
attribute at the moment. In the future, there will be more: non-recycling mode, variable height, and maybe an additional of <au-virtual-repeat>
custom element for more control over the behavior of the repeat.Set
& Map
are harder as they require better collection to index mappingFAQs
An Aurelia 2 virtual repeat implementation.
We found that aurelia-v2-virtual-repeat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.