Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add events to disco pane #543

Merged

Conversation

muffinresearch
Copy link
Contributor

@muffinresearch muffinresearch commented Jun 6, 2016

return {
handleGlobalEvent(e) {
const { id, type, needsRestart } = e;
const payload = { guid: id, needsRestart };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice if this mostly moved into addonManager. So this could be:

componentDidMount() {
  addonManager.addChangeListener(handleGlobalEvent);
}

return {
  handleGlobalEvent(type, payload) {
    dispatch({type, payload});
  }
};

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a7c937d on muffinresearch:add-events-to-disco-pane into 3971f04 on mozilla:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0590810 on muffinresearch:add-events-to-disco-pane into 3971f04 on mozilla:master.


Object.keys(eventMap).forEach((event) => {
const action = eventMap[event];
it(`dispatches ${action}`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispatch might not be the best word to use for this. I think the callback actually calls dispatch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a bit of a leftover from refactoring, I'll update it.

@mstriemer
Copy link
Contributor

r+wc

@muffinresearch
Copy link
Contributor Author

muffinresearch commented Jun 7, 2016

  • I upper-cased all the constants aside from the ones related to API data.
  • There was a errant i18n being passed down in an install func which I removed too.
  • I had to add DISABLEDand ENABLED to the validInstallStates to prevent an exception.

@muffinresearch
Copy link
Contributor Author

I'll file a bug separately for making the stubAddonManager thing more distinct.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 32918b2 on muffinresearch:add-events-to-disco-pane into c81d069 on mozilla:master.

function handleChangeEvent(e) {
const { id, type, needsRestart } = e;
log.info('Event received', {type, id, needsRestart});
if (globalEventStatusMap.hasOwnProperty(type)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this should be a Map if it has Map in the name. Unfortunately it looks like Map needs to be initialized with an array of key/value pairs but that's probably still nicer than using a plain object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't feel too strongly it must be a map, since it's just a lookup.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling fc07ce9 on muffinresearch:add-events-to-disco-pane into c81d069 on mozilla:master.

@muffinresearch muffinresearch merged commit 9b27874 into mozilla:master Jun 8, 2016
@muffinresearch muffinresearch deleted the add-events-to-disco-pane branch June 8, 2016 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it clearer what stubAddonManager stubs. Use the global AddonManager events
3 participants