question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Here’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:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
bobylitocommented, May 22, 2017

So, I was looking to tap into a refine or render event where I could get the facet refined/total facets count and append them to my header.

This is not a use case for events. I’m gonna answer to you directly with some more elements @timkelty

1reaction
bobylitocommented, May 20, 2017

@vvo did this end up anywhere?

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found