Widget events
See original GitHub issueHere’s what we could do to be able to have events on widgets. Like refine
app.js
var instantsearch = require('instantsearch');
var search = instantsearch(...);
var refinementList = instantsearch.widgets.refinementList(...);
var slider = instantsearch.widgets.slider(...);
refinementList.on('refine', function(newValue, previousValue) {});
slider.on('slide');
slider.on('change');
search.addWidget(refinementList);
search.addWidget(slider);
Widget.js
var EventEmitter = require('events');
class Widget extends EventEmitter {}
Widget.utils = {
getContainerNode() {}
}
module.exports = Widget;
IndexSelector.js
var toFactory = require('to-factory');
var React = require('react');
var Widget = require('../Widget');
class IndexSelector extends Widget {
getConfiguraition(){}
init(){}
render(){}
}
// can use this.emit(); at any time
// can use Widget.utils.getContainerNode of course
// allows to use indexSelector() instead of new `IndexSelector()`
module.exports = toFactory(Widget);
For people to build their own eventful widgets (non events widgets is not an issue here) outside of a browserify/webpack env (where it’s easy to extend EventEmitter): we can expose utils in instantsearch namespace like inherits and EventEmitter.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Widget Events — Jupyter Widgets 7.7.2 documentation
Traitlet events¶. Widget properties are IPython traitlets and traitlets are eventful. To handle changes, the observe method of the widget can be used...
Read more >Event Calendar - Add Calendar widget to website (free and fast)
Event widget allows sharing your events with the rest of the world. It includes multiple events, different tags, your own images and videos,...
Read more >Overview of Calendar Widgets - Knowledgebase
The Events Calendar widget creates a mini-grid calendar in your sidebar. Days with events are darker and show a dot. The current month...
Read more >Working with Widget Events - Using IDL
Identifying Widget Type from an Event; Keyboard Focus Events; Timer Events; Tracking Events; Context Menu Events. Interrupting the Event Loop. Beginning with ...
Read more >IBM Case Manager - Widget, action, and page events and wiring
The Case Toolbar widget handles events to display and process actions that the user can perform for a case.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not a use case for events. I’m gonna answer to you directly with some more elements @timkelty
No there is no implementation of events on widgets. Can you tell us about your use case, so that we can figure out a solution together?