
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@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
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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.