node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »



a cirular buffer that creates a delay. You set the length of the delay in TypedArray values, and then you read and write to it.


first you construct the delay function with a "length" param, and a TypedArray constructor

var ddelay = require('data-delay')
var delay = ddelay(1000, Int8Array, reverse?)
// this creates a delay loop 1000 units long, in this case the unit being a single Int8Array value 
// that means a value written now will be return after 1000 calls of .read()
delay.write(255) and delay.write will automatically index and return the values. if you read and don't write, or vice versa, you will off-center the circular buffer. may be kewl.


seems to work, based on my previous experience with circular delay buffers, such as jdelay