2.16.0 • Published 5 years ago
livefilter v2.16.0
Live Filter
Turns a form in to a live updating filter with routing
Installing
npm install livefilter
Using
<form action="my-route.html" class="my-form">
<label for="cars">Volvo</label>
<input name="cars" id="cars" value="volvo" />
<label for="cars">SAAB</label>
<input name="cars" id="cars" value="saab" />
<input type="submit" value="Submit" style="display: none;"/>
</form>
var LiveFilter = require('livefilter');
var form = document.querySelector('.my-form');
new LiveFilter(form, {
beforeFetch: function() {
// Do stuff right before the fetch has responded
},
afterFetch: function(data) {
// Do stuff with fetched data.
},
onUpdateUrl: function() {
// Do stuff when url is updated but before data is fetched.
},
// An object where keys are the event to listen for and value is either a string representing a query selector
// or an object with mandatory property selector (query selector) and optional debounce set to true for
// debouncing incoming events such as keyup.
triggers: {
change: 'input[type="radio"]',
keyup: {
selector: 'input[type="search"]',
debounce: true
}
}
// A list of selectors or DOM elements that should be notified with event when a fetch is finished.
// Event to contains property data which holds the json response from the server.
// Event is called 'livefilterfetched'
subscribers: [],
// By default we prevent form from being submitted. Set to false to skip.
preventSubmit: true
});
2.16.0
5 years ago
2.15.0
6 years ago
2.14.1
6 years ago
2.14.0
6 years ago
2.13.0
6 years ago
2.12.1
6 years ago
2.12.0
6 years ago
2.11.0
6 years ago
2.10.0
6 years ago
2.9.0
6 years ago
2.8.1
6 years ago
2.8.0
6 years ago
2.7.2
6 years ago
2.7.1
7 years ago
2.7.0
7 years ago
2.6.0
7 years ago
2.5.0
7 years ago
2.4.1
7 years ago
2.4.0
7 years ago
2.3.0
7 years ago
2.2.0
7 years ago
2.1.0
7 years ago
2.0.0
7 years ago
1.8.0
8 years ago
1.7.0
8 years ago
1.6.0
8 years ago
1.5.0
8 years ago
1.4.0
8 years ago
1.3.0
8 years ago
1.2.0
8 years ago
1.1.0
8 years ago
1.0.0
8 years ago