4.0.0 • Published 7 years ago

dominate-core v4.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Dominate-Core

Daisy chain filtering

Dominate is a JavaScript framework for filtering arrays of items. A Dominate instance is made up of an InputNode, OutputNode, and a chain of Filters connecting them. The InputNode allows your application to supply Dominate with the original array of items to be filtered. Each filter then subsequently removes 0 or more items before passing it on to the next filter in the chain. Finally, the OutputNode provides your application with the array of items which made it through the filters.

API

Constructor

let instance = require('dominate-core')(inputNode, outputNode);

Creates a new Dominate instance. The InputNode and OutputNode must be supplied at construction time

Adding Filters

let filterApi = instance.addFilter(FilterFactory, options);

Adds a new instance of a filter to the filter chain. FilterFactory is the filter's constructor function. options is the options for this filter instance. The return value is the filter instance's "api object". This object may contain variables and functions which control the filter's behavior. The api object is also used to remove the filter from the instance of the framework.

Removing Filters

instance.removeFilter(filterApi);

Removes a filter instance from the filter chain. filterApi is the filter's api object returned when the filter was added.

Updating the OutputNode

instance.update();

Forces an update of the OutputNode. Normally, filters only refilter content when they detect a relevant change. Calling this function forces all the filters to refilter the content.

Examples

To see an usage examples and implementations of input nodes, output notes, and filters, check out the test code.

4.0.0

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago