# uwire **Repository Path**: mirrors_WebReflection/uwire ## Basic Information - **Project Name**: uwire - **Description**: A way to create persistent fragments - **Primary Language**: Unknown - **License**: ISC - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2025-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # µwire [![Build Status](https://travis-ci.com/WebReflection/uwire.svg?branch=master)](https://travis-ci.com/WebReflection/uwire) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/uwire/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/uwire?branch=master) A way to create persistent "_wired_" fragments that can be moved around when diffed through _[µdomdiff](https://github.com/WebReflection/udomdiff#readme)_. ```js import {diffable, persistent} from 'uwire'; const wire = persistent(fragment); diffable(wire, 1); // repopulate all nodes, if gone, returns the fragment diffable(wire, 0); // return the initial fragment firstChild diffable(wire, -0); // return the initial fragment lastChild diffable(wire, -1); // remove all nodes and return the firstChild ``` If the fragment has only one child node, the `diffable` will always return that child node instead, making it a no-op. ### Why it this called _wire_? It's like attaching, via strings (_wires_), the behavior of a _fragment_ that cannot be used to obtain the same result. A _wire_ is not really a fragment per se, but it carries with it all it's needed to reuse, move, remove, re-append, such fragment. ``` ┌--------▶[fragment] ◀---[wire] | ├--------▶├ firstChild | ├ ... └--------▶└ lastChild ```