-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Removed private methods of plugins and generalized plugins' access #1928
Removed private methods of plugins and generalized plugins' access #1928
Conversation
… HTML5 audio tag and use it with WebAudio features.
- Put the possibility of handle audio tag with API Web Audio directly in the MediaElement backend, setting a new wavesurfer boolean parameter, 'mediaElementWebAudio', to true.
- fixed version number and switch-case
- updated changelog and added examples.
- added the possibility to inherit also the Region class - generalized access to wavesurfer's plugins properties, so the custom plugins can be defined with custom names
Another thing. The
bacause `Wavesurfer['regions']' give this: so
|
If we do that I would place the plugin files in it's own directory, e.g. Splitting into multiple files/classes would be useful for the other larger plugins as well. And can you also add a changelog entry? |
- Region class and RegionsPlugin class moved in plugin/regions - modified the building plugins procedure to find recursively plugins in directories
Short description of changes:
Removed all private methods of plugin classes, so the plugins can be extended avoiding duplicated code, because private methods can not be inherited.
Allow to extend also the
Region
class, introducing the possibility to create yourRegionCustom
class that extends the basic one, overriding its methods if necessary.Generalized access to plugins object: in some plugin classes, the access to their own params was made from the outside. For example, to access to the
timeline
pluginduration
parameter, the access was done in this way:this.wavesurfer.timeline.params.duration
instead of:
this.params.duration
.Accessing this parameter from the outside made it impossible to call custom plugins with custom names, because to the
wavesurfer
object is assigned a plugin with the name you give it. So, if you for example call ittimelineCustom
, the access to theduration
parameter from the outside, should be insteadthis.wavesurfer.timelineCustom.params.duration
. But in this way you cannot generalize the plugin class.Breaking changes in the internal API:
Removed private methods from the
cursor.js
andtimeline.js
files.In the
timeline
plugin, access to theduration
parameter from itsparams
object.Added
export
clause to theRegion
class, so it can be also extended.Access to the
getRegionSnapToGridValue
method of theregions
plugin from the internalutil
object, instead of from the outside.Pass to the
Region
class constructor, theutil
object of theRegionsPlugin
class, so thegetRegionSnapToGridValue
method have not be accessed from outside.Related Issues and other PRs:
Issue #1914
PR #1921