2.16.0 • Published 7 years ago

livefilter v2.16.0

Weekly downloads
5
License
ISC
Repository
-
Last release
7 years ago

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

7 years ago

2.15.0

8 years ago

2.14.1

8 years ago

2.14.0

8 years ago

2.13.0

8 years ago

2.12.1

8 years ago

2.12.0

8 years ago

2.11.0

8 years ago

2.10.0

8 years ago

2.9.0

8 years ago

2.8.1

8 years ago

2.8.0

8 years ago

2.7.2

8 years ago

2.7.1

9 years ago

2.7.0

9 years ago

2.6.0

9 years ago

2.5.0

9 years ago

2.4.1

9 years ago

2.4.0

9 years ago

2.3.0

9 years ago

2.2.0

9 years ago

2.1.0

9 years ago

2.0.0

10 years ago

1.8.0

10 years ago

1.7.0

10 years ago

1.6.0

10 years ago

1.5.0

10 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago