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

Load plugins from parameters #2514

Merged
merged 5 commits into from
Jan 7, 2020
Merged

Load plugins from parameters #2514

merged 5 commits into from
Jan 7, 2020

Conversation

yann300
Copy link
Collaborator

@yann300 yann300 commented Jan 6, 2020

This PR:

  • refactor the way plugins are loaded at page load.
  • load from query param if provided, from local storage if not.

@yann300 yann300 force-pushed the loadPluginsFromParameters branch 2 times, most recently from e21c899 to 034f028 Compare January 6, 2020 17:18
localStorage.setItem('workspace', JSON.stringify(actives))
}
},
get: () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use inline arrow function: get: () => JSON.parse(localStorage.getItem('workspace'))

this.loaders['queryParams'] = {
set: () => {},
get: () => {
let plugins = queryParams.get()['plugins']
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use const & destructuration here: const { plugins } = queryParams.get()

}

set (plugin, actives) {
this.loaders[this.current].set(plugin, actives)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be worthy to have a getter method in the class for that :

get currentLoader() {
  return this.loaders[this.current]
}

@@ -0,0 +1,17 @@
'use strict'
var init = require('../helpers/init')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use const for new code

@@ -232,3 +231,40 @@ export class RemixAppManager extends PluginEngine {
]
}
}

class PluginLoader {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add comment to explain what this class is about.

@yann300 yann300 merged commit 47cfb63 into master Jan 7, 2020
@yann300 yann300 deleted the loadPluginsFromParameters branch January 7, 2020 11:00
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.

3 participants