# @gecut/lit-helper

Latest version **2.4.7** (published 2024-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gecut/lit-helper
pnpm add @gecut/lit-helper
yarn add @gecut/lit-helper
bun add @gecut/lit-helper
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.7 |
| Published | 2024-10-25 |
| First published | 2023-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 12 |
| Unpacked size | 75.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | S. MohammadMahdi Zamanian |
| Maintainers | mm25zamanian |
| Keywords | gecut |

## Links

- npm: https://www.npmjs.com/package/@gecut/lit-helper
- Repository: https://github.com/gecut/hybrid-ui
- Homepage: https://github.com/gecut/hybrid-ui#readme
- Issues: https://github.com/gecut/hybrid-ui/issues
- npm.io page: https://npm.io/package/@gecut/lit-helper

## Dependencies (12)

- [lit](https://npm.io/package/lit.md) ^3.1.3
- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [lit-html](https://npm.io/package/lit-html.md) ^3.1.2
- [type-fest](https://npm.io/package/type-fest.md) ^4.13.0
- [@gecut/types](https://npm.io/package/@gecut/types.md) ^7.0.3
- [@gecut/logger](https://npm.io/package/@gecut/logger.md) ^7.0.3
- [@gecut/mixins](https://npm.io/package/@gecut/mixins.md) ^2.2.4
- [@gecut/signal](https://npm.io/package/@gecut/signal.md) ^7.0.3
- [@material/web](https://npm.io/package/@material/web.md) ^1.4.1
- [@vaadin/router](https://npm.io/package/@vaadin/router.md) ^1.7.5
- [@gecut/utilities](https://npm.io/package/@gecut/utilities.md) ^7.0.3
- [@gecut/data-manager](https://npm.io/package/@gecut/data-manager.md) ^1.2.3

## Recent versions

- 2.4.7 (latest) — 2024-10-25
- 1.0.0 (next) — 2023-12-20
- 2.4.6 — 2024-10-25
- 2.4.5 — 2024-10-25
- 2.4.4 — 2024-07-08
- 2.4.3 — 2024-07-06
- 2.4.2 — 2024-07-06
- 2.4.1 — 2024-07-04
- 2.4.0 — 2024-07-04
- 2.3.0 — 2024-06-29
- 2.2.1 — 2024-06-26
- 2.2.0 — 2024-06-22
- 2.1.5 — 2024-06-11
- 2.1.4 — 2024-06-11
- 2.1.3 — 2024-05-30
- … 14 more at https://npm.io/package/@gecut/lit-helper/versions

## README

# Gecut Data Manager

<!-- TODO: Write a Description -->

## Receiver Concept

receiver of data and cache on memory ram and update

## Sender Concept

sender of data and update dependencies data, for example when create new todo, should update todo list data

# How can i use ?

step by step to use `@gecut/data-manager`

## First Step

define type of receivers and senders

```ts
declare global {
  interface GecutReceiverServices {
    readonly 'todo-storage': TodoInterface[];
  }
  interface GecutSenderServices {
    readonly 'new-todo': TodoInterface;
  }
}
```

## Second Step

define dataManager from a new instance of `DataManager` class

```ts
const dataManager = new DataManager(
  {
    'todo-storage': {
      receiverFunction() {
        // receive todo-storage data and return
        return api.storage.query();
      },
    },
  },
  {
    'new-todo': {
      // when send data update todo-storage
      dependencies: ['todo-storage'],
      async senderFunction(newTodo) {
        // send new todo data to back-end
        await api.new.mutate(newTodo);
      },
    },
  },
);
```

## Third Step

```ts
// define this in Component Class and use
// receiver decorator has autoUpdate (automatic requestUpdate)
@receiver('todo-storage', dataManager)
todoStorage!: TodoInterface[];
```

## Fourth Step

```ts
// use this for send data
dataManager.senders['new-todo']?.send({
  status: true,
  message: textInputValue,
});
```

---
_Source: https://npm.io/package/@gecut/lit-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
