Commit 3a34fe22647bc259e8f902bb86afcea5782a87a9
1 parent
ddd060d2cb
Exists in
master
Perbesar circular buffer history jadi 1000
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
lib/history.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | const CircularBuffer = require("circular-buffer"); | 3 | const CircularBuffer = require("circular-buffer"); |
4 | const history = new CircularBuffer(200); | 4 | const history = new CircularBuffer(1000); |
5 | 5 | ||
6 | function push(item) { | 6 | function push(item) { |
7 | history.push(item); | 7 | history.push(item); |
8 | } | 8 | } |
9 | 9 | ||
10 | function dump() { | 10 | function dump() { |
11 | const result = history.toarray(); | 11 | const result = history.toarray(); |
12 | console.log(JSON.stringify(result, null, 2)); | 12 | console.log(JSON.stringify(result, null, 2)); |
13 | return result; | 13 | return result; |
14 | } | 14 | } |
15 | 15 | ||
16 | exports.push = push; | 16 | exports.push = push; |
17 | exports.dump = dump; | 17 | exports.dump = dump; |