plugin type definition
See original GitHub issueWavesurfer.js version(s)
v4.0.1
Browser and operating system version(s)
Chrome 84.0.4147.125, Windows 10 Pro
Code needed to reproduce the issue
Plugin example from (here)[https://wavesurfer-js.org/example/spectrogram/index.html] seems not working in typescript.
import Wavesurfer from 'wavesurfer.js'
let wavesurefer: Wavesurfer;
wavesurfer = Wavesurfer.create({
...
plugins: [
Wavesurfer.spectrogram.create({
fftSamples: 2048,
...
})
]
});
I saw PluginDefinitions are well described in index.d.ts
as below:
interface PluginDefinition {
name: String;
staticProps?: object;
deferInit?: boolean;
params: object;
instance: { new (params: object, ws: WaveSurfer): WaveSurferPlugin };
}
I saw documents and issues, but there are no available informations about name
, staticProps
and so on.
My question is how to use plugin in typescript, and any example about typescript and plugin would be appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18
Top Results From Across the Web
Plugin Definitions | Plugin API | Drupal Wiki guide on Drupal.org
Plugins play an integral role in facilitating user interface components. While the plugin system can be used for more situations than this.
Read more >Plugin types - MoodleDocs
Plugin type Component name (Frankenstyle) Moodle path
Activity modules mod /mod
Antivirus plugins antivirus /lib/antivirus
Assignment submission plugins assignsubmission /mod/assign/submission
Read more >Define a New Plugin Type - Drupalize.Me
Knowing how to define a new plugin type will allow you to write modules that are more extensible, and more configurable.
Read more >Module: Plugin - TypeScript: Documentation
Some plugins add or modify top-level exports on existing modules. While this is legal in CommonJS and other loaders, ES6 modules are considered...
Read more >@xapp/serverless-plugin-type-definitions - npm
serverless-plugin-type-definitions. Typescript definitions that can be used to make Serverless Plugins. Simply import this project and go.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get the plugins to work with Typescript by doing the following:
dist
folder:import SpectrogramPlugin from 'wavesurfer.js/dist/plugin/wavesurfer.spectrogram';
var wavesurfer = WaveSurfer.create({ // wavesurfer options ... plugins: [ SpectrogramPlugin.create({ // plugin options ... }) ] });
"noImplicitAny": false
totsconfig.json
.Definitely not as ideal as having a proper Typescript definition, but at least I am now able to use the plugins.
For examples of how to actually use the plugins etc in Typescript, see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wavesurfer.js/wavesurfer.js-tests.ts
I personally would not approve any new development that wanted to use Javascript rather than Typescript here in 2021. Thanks!