Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/history
Keep track of and cycle through capped history (chat messages, REPL command-lines etc)
https://github.com/component/history
Last synced: 13 days ago
JSON representation
Keep track of and cycle through capped history (chat messages, REPL command-lines etc)
- Host: GitHub
- URL: https://github.com/component/history
- Owner: component
- Created: 2012-08-17T17:05:36.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-03T20:37:02.000Z (almost 11 years ago)
- Last Synced: 2024-05-08T17:11:46.527Z (8 months ago)
- Language: JavaScript
- Size: 151 KB
- Stars: 8
- Watchers: 12
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# History
Keep track of and cycle through capped history (chat messages, REPL command-lines etc).
## Installation
```
$ component install component/history
```## API
### History(vals)
Initialize with an array of `vals`.
### History#add(val)Add a value, for example a chat message or REPL command line.
This method resets the history index, meaning the next call
to `.back()` will be this latest value.### History#prev()
Cycle backwards through history, returning a value added by `.add()`.
### History#next()
Cycle forwards through history, returning a value added by `.add()`.
### History#max(n)
The maximum number of entries defaulting to `1000`.
### History#reset()
Reset the index to the latest value.
## License
MIT