Buffer

The buffer accepts a function. Each function it is given is run, but at a specific rate.

An example of this is the growl component, which buffers the creation of growls to once every half second.

This ensures the user is not bombarded by too many messages at once.

k$.buffer(function() {
  console.log('hello world');
})

The buffer can also take a custom delay between firing functions

Notice the delay only applies when the buffer has started. This will not adjust the delays for a buffer that is currently being run.

k$.buffer(function() {
  console.log('hello world');
}, 1000);

Debouncing

You can also debounce a component with k$.debounce()

A debouncer prevents a single function from being executed until X milliseconds have elapsed since it was last sent through the debouncer.

An example usage of the debouncer is the status component, which delays hiding itself until the function hasn't been called for 2000ms

k$.debounce(myfunc, 'save name')