DYEBench should use TodoMVC to test FlightJS for consistency
[WebKit-https.git] / PerformanceTests / DoYouEvenBench / resources / todomvc / dependency-examples / flight / app / js / ui / with_filters.js
1 /*global define, $ */
2 'use strict';
3
4 define(function () {
5     return function withFilters() {
6         this.defaultAttrs({
7             filterSelector: '#filters a'
8         });
9
10         this.chooseFilter = function (e, data) {
11             var filter = data.el.hash.slice(2);
12
13             this.select('filterSelector').removeClass('selected');
14             $(data.el).addClass('selected');
15             this.trigger('uiFilterRequested', { filter: filter });
16         };
17
18         this.markSelected = function (filter) {
19             this.$node.find('[href="#/' + filter + '"]').addClass('selected');
20         };
21
22         this.after('initialize', function () {
23             this.on('click', { filterSelector: this.chooseFilter });
24         });
25     };
26 });