-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.hbs
78 lines (53 loc) · 1.53 KB
/
README.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Undoo
Undo/redo manager
<a href="https://travis-ci.org/fabioricali/undoo" target="_blank"><img src="https://travis-ci.org/fabioricali/undoo.svg?branch=master" title="Build Status"/></a>
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" title="License: MIT"/></a>
## Installation
### Node.js
```
npm install undoo --save
```
### Browser
#### Local
```html
<script src="node_modules/undoo/dist/undoo.min.js"></script>
```
#### CDN unpkg
```html
<script src="https://unpkg.com/undoo/dist/undoo.min.js"></script>
```
## Example
```javascript
const Undoo = require('undoo');
const myHistory = new Undoo();
myHistory
.save('one')
.save('two')
.save('three')
.save('four');
myHistory.undo((item)=>{
console.log(item); //=> three
});
myHistory.current(); //=> three
myHistory.redo((item)=>{
console.log(item); //=> four
});
```
## Use provider
```javascript
const Undoo = require('undoo');
const myHistory = new Undoo({
provider: () => document.getElementById('myTextArea').value
});
myHistory.save();
```
## Demo
<a href="https://fabioricali.github.io/undoo/sample/">Try now</a>
## API
{{>main}}
## Changelog
You can view the changelog <a target="_blank" href="https://github.com/fabioricali/undoo/blob/master/CHANGELOG.md">here</a>
## License
Undoo is open-sourced software licensed under the <a target="_blank" href="http://opensource.org/licenses/MIT">MIT license</a>
## Author
<a target="_blank" href="http://rica.li">Fabio Ricali</a>