# vue-di-helper

> help vue3 DI

Latest version **0.0.4** (published 2022-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-di-helper
pnpm add vue-di-helper
yarn add vue-di-helper
bun add vue-di-helper
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-03-11 |
| First published | 2022-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 45 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | willx12123 |
| Maintainers | willx12123 |

## Links

- npm: https://www.npmjs.com/package/vue-di-helper
- npm.io page: https://npm.io/package/vue-di-helper

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^3.2.26
- [typescript](https://npm.io/package/typescript.md) ^4.4.4

## Recent versions

- 0.0.4 (latest) — 2022-03-11
- 0.0.3 — 2022-01-06
- 0.0.2 — 2022-01-03
- 0.0.1 — 2022-01-03

## README

# vue-di-helper

## Installation

```bash
npm i vue-di-helper
# OR
yarn add vue-di-helper
# OR
pnpm add vue-di-helper
```

## Usage

### STEP 1: Create Service

```ts
import { Ref, ref } from "vue";

export class SomeService {
  // ...

  count: Ref<number>;

  constructor() {
    this.count = ref(0);
  }

  increase = () => {
    this.count.value++;
  };

  // ...
}
```

### STEP2: provide in parent

```vue
<template></template>

<script setup lang="ts">
//...
import { provide } from "vue-di-helper";

import { SomeService } from "path/to/some.service.ts";

provide(SomeService);
//...
</script>
```

### STEP3: inject in children

```ts
import { inject } from "vue-di-helper";

import SomeService from "./some.service.ts";

const someService = inject(SomeService);
```

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