# promise-vue

> Ultra simple component to work with Promise.

Latest version **1.0.1** (published 2020-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install promise-vue
pnpm add promise-vue
yarn add promise-vue
bun add promise-vue
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-10-27 |
| First published | 2020-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | https://github.com/freek7 |
| Maintainers | odiian |
| Keywords | vue, promise, promise-vue, async, ajax, axios |

## Links

- npm: https://www.npmjs.com/package/promise-vue
- Repository: https://github.com/freek7/promise-vue
- Homepage: https://github.com/freek7/promise-vue#readme
- Issues: https://github.com/freek7/promise-vue/issues
- npm.io page: https://npm.io/package/promise-vue

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [core-js](https://npm.io/package/core-js.md) ^3.6.5

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-10-27
- 1.0.0 — 2020-10-27
- 0.1.7 — 2020-10-27
- 0.1.6 — 2020-10-27
- 0.1.531 — 2020-10-27
- 0.1.53 — 2020-10-27
- 0.1.52 — 2020-10-27
- 0.1.51 — 2020-10-27
- 0.1.5 — 2020-10-27
- 0.1.4 — 2020-10-27
- 0.1.3 — 2020-10-27
- 0.1.2 — 2020-10-25
- 0.1.1 — 2020-10-25
- 0.1.0 — 2020-10-25

## README

# promise-vue
Ultra simple component to work with Promise. 

### Installation
It may be installed  as [npm package](https://www.npmjs.com/package/promise-vue "npm")

    npm i promise-vue
	import VuePromiseComponent from 'promise-vue'
	
then register as component


    components: {
        "promise-vue": VuePromiseComponent,
      }
	  
### How to use
In promise You have 3 state
1. **pendding**
2. **resolved** 
3. **error**

So all you need it pass promise to `promise-vue` component
it looks like : 
```html
<promise-vue :delay="delay" :promise="examplePromise" tag="div">
	<template v-slot:pendding>
		<div>Loadding...</div>
	</template>

	<template v-slot:resolved="data">
		<pre>{{ data }}</pre>
	</template>

	<template v-slot:error="error">
		<pre>Opss... {{ error }}</pre>
	</template>
</promise-vue>
```

### Slots

- `v-slot:pendding` : shows when promise pending/loading
- `v-slot:resolved="data"` : scoped slot with received data
- `v-slot:error="error"` : scoped slot with error data

### Props
- `promise` : just promise
- `tag` : tag to wrap by default - div
- `delay` : delay  of minimum time to show loading slot by default - 0


------------

P.S. real example in **src\Example.vue**

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