
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@y-block/array
Advanced tools
The `y-array` component is a custom web component built with Atomico and Yjs. It allows you to bind and observe a Yjs `Y.Array` in a reactive manner, rendering its items dynamically based on provided templates.
The y-array
component is a custom web component built with Atomico and Yjs. It allows you to bind and observe a Yjs Y.Array
in a reactive manner, rendering its items dynamically based on provided templates.
Property | Type | Description |
---|---|---|
array | Y.Array | A Yjs Array instance to be observed and rendered. |
Property | Type | Description |
---|---|---|
Unassigned | ChildNode | The item template |
If you have an array of strings like this:
doc.getArray('my-array').insert(0, ["Hello", "Array!"])
You can create a component like this:
<y-array array="doc.getArray('my-array')">
<input $:placeholder="item" />
</y-array>
If you have an array of objects, you can create and use the y-array component like this:
doc.getArray('my-array').insert(0, [
{firstName: "Hello", lastName:"Array!", style:{padding: "5px", margin: "5px"}},
{firstName: "So", lastName:"Sweet!", style:{padding: "5px", margin: "5px"}}
])
<y-array array="doc.getArray('my-array')">
<input $:placeholder="firstName" $:style="style" />
<input $:placeholder="lastName" $:style="style" />
</y-array>
The Lazy story demonstrates how to dynamically update the array over time. This example pushes a new item to the array every second.
<script>
const lazyArray = doc.getArray('lazyArray')
lazyArray.push([{ text: "Lazy loading..", idx: 1 }]);
setInterval(() => {
lazyArray.push([{ text: `item ${idx}`, idx: lazyArray.get(lazyArray.length - 1).idx + 1 }]);
}, 1000)
</script>
<y-array array="doc.getArray('lazyArray')">
<input $:placeholder="text"></input>
<input $:placeholder="idx"></input>
</y-array>
FAQs
### Properties
The npm package @y-block/array receives a total of 0 weekly downloads. As such, @y-block/array popularity was classified as not popular.
We found that @y-block/array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.