# knockout-inline-confirm

> A simple binding to get confirmation from users inline before performing an action

Latest version **2.0.0** (published 2016-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install knockout-inline-confirm
pnpm add knockout-inline-confirm
yarn add knockout-inline-confirm
bun add knockout-inline-confirm
```

## 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 | 2.0.0 |
| Published | 2016-10-03 |
| First published | 2016-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | CivicSource |
| Maintainers | civicsource |
| Keywords | knockout, confirm, inline confirm |

## Links

- npm: https://www.npmjs.com/package/knockout-inline-confirm
- Repository: https://github.com/civicsource/knockout-inline-confirm
- Homepage: https://github.com/civicsource/knockout-inline-confirm#readme
- Issues: https://github.com/civicsource/knockout-inline-confirm/issues
- npm.io page: https://npm.io/package/knockout-inline-confirm

## Dependencies (1)

- [jquery](https://npm.io/package/jquery.md) >=1.10

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@versini/auth0-auth-js-stub](https://npm.io/package/@versini/auth0-auth-js-stub.md) — 0 weekly downloads
- [@loutre-run/core](https://npm.io/package/@loutre-run/core.md) — 0 weekly downloads
- [@crvouga/mockingbird-service-prism](https://npm.io/package/@crvouga/mockingbird-service-prism.md) — 0 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2016-10-03

## README

#Knockout Inline Confirm Binding

> A simple knockout binding that allows you to get a confirmation of action from the user before executing an action.

Read a [full introduction](http://dev.archoninfosys.com/2014/02/knockout-inline-confirm/) to this component with a small demo.

##Installation

```
npm install knockout-inline-confirm
```

Then add `knockout-inline-confirm.js` to your project.

## Usage

###Confirm a Link Click

```html
<a href="/remove" data-bind="inlineConfirm: ['Remove', 'Are you sure?', 'Removing']"></a>
```

The browser will not navigate to the `/remove` link until the user confirms the action.

###Confirm a Button Action

```html
<button data-bind="inlineConfirm: ['Execute', 'Are you really sure?', 'Executing'], submitFunction: execute"></button>
```

This would allow the user to confirm their action before calling the `execute` function on the view model.


###Working with promises

in the following example
```html
<button data-bind="inlineConfirm: ['Execute', 'Are you really sure?', 'Executing'], submitFunction: execute"></button>
```
if the submitFunction executes asynchronously (an ajax request for example), 'Executing' will not appear when the function is executing unless the function returns the promise object since it does not know to wait until the promise resolves. Ex:

```javascript
this.executeReturningPromise = function () {
			return $.ajax("http://myApi/items", {
				type: "GET",
			}).then(function (data) {
				//do some stuff with the data
			});
		}
```
```html
<button data-bind="inlineConfirm: ['Execute', 'Are you really sure?', 'Executing'], submitFunction: executeReturningPromise"></button>
```

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