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

Fix order of arguments for PluginClass.constructor #1472

Merged
merged 1 commit into from
Oct 9, 2018

Conversation

higuri
Copy link
Contributor

@higuri higuri commented Oct 1, 2018

Short description of changes:

Before

  • The PluginClass (base class defined in src/wavesurfer.js) has constructor(ws, params)
  • *Plugin (concrete classes defined in src/plugin/*.js) have constructor(params, ws)
  • The WaveSurfer object instantiates plugins with new *Plugin(params, ws)

After

  • The PluginClass has constructor(params, ws)

Breaking in the external API:

None

Breaking changes in the internal API:

None

Todos/Notes:

None

Related Issues and other PRs:

None

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 69.54% when pulling f7b3a89 on higuri:patch-1 into c0a802a on katspaugh:master.

@higuri
Copy link
Contributor Author

higuri commented Oct 2, 2018

Now I reviewed these changes and I came to think that it is better to change concrete Plugin classes instead of the base Plugin class. I mean constructor(ws, params) is better than constructor(params, ws), because params is an optional argument that can be omitted.

Is it okay if I change all constructor of concrete Plugin classes and the line that instantiates them?
I'm sorry for this poor PR. 😓

@thijstriemstra thijstriemstra removed the bug label Oct 2, 2018
@thijstriemstra
Copy link
Contributor

@higuri

I came to think that it is better to change concrete Plugin classes instead of the base Plugin class.

I'm not sure, your fix looks ok to me. In the end it's not going to matter much what the var is called, javascript will not treat them differently, no matter what they're called.

@higuri
Copy link
Contributor Author

higuri commented Oct 8, 2018

Then, would you merge the current commit?

The motivation of this PR is that those who make new plugins may implement their constructors which don't work as intended, since the constructor of the plugin base class is defined differently from the actual calling way.
This can be solved with the current commit, so it is okay to keep it.

@thijstriemstra
Copy link
Contributor

Thanks!

@thijstriemstra thijstriemstra merged commit 3b24bc6 into katspaugh:master Oct 9, 2018
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.

None yet

3 participants