[annotator-dev] Question about "DeprecationWarning: Direct assignment of plugin constructors[...]"

Ernesto Torresin (ML) ewk-ml at connettivo.net
Tue Jun 17 16:14:06 UTC 2014


Reading the code, I see that it is full of such deprecation warnings.
They seem to always come with a proper rewrapping, so I cannot see yet
what is the "next" plain way to do things. Well, I'll go on see what I
can understand. Thanks for your efforts, BTW.

E.T.

On 17/06/2014 14:15, Ernesto Torresin (ML) wrote:
> Hello
> 
> I see that the Annotator has been changing much in the past two years. I
> cannot grasp yet what is deprecated and what is seminal, so I read the
> code and think.
> 
> Today I tried to write a dumb plugin for Annotator 1.2.9 and I cannot
> get why I get a console warning
> ##########################################
> "Annotator DeprecationWarning: Direct assignment of plugin constructors
> to the Annotator.Plugin namespace is deprecated. Please use
> Annotator.Plugin.register('Testplugin', Testplugin) instead!
> Automatically re-registering plugin..."
> ##########################################
> 
> Here is the code
> ------------------------------------------
> src/plugin/testplugin.coffee
> ------------------------------------------
> Annotator = require('annotator')
> 
> class TestPlugin
> 
>   pluginInit: ->
>     this.annotator.subscribe('annotationCreated', this.create)
> 
>   create: (annotation) ->
>     console.log("Annotation created")
> 
> Annotator.Plugin.register('TestPlugin', TestPlugin)
> 
> module.exports = TestPlugin
> 
> ------------------------------------------
> 
> This is called on a modified version of the default "demo.html" page with
> ------------------------------------------
> <script src="pkg/annotator.testplugin.js"></script>
> ------------------------------------------
> and then
> ------------------------------------------
> <script>
>      var elem = document.getElementById('airlock');
>         var annotator = new Annotator(elem);
>         annotator.addPlugin('TestPlugin');
> </script>
> ------------------------------------------
> 
> What am I doing wrong?
> 
> Thank you
> 
> Ernesto Torresin
> _______________________________________________
> annotator-dev mailing list
> annotator-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
> 
> 




More information about the annotator-dev mailing list