[]
        
(Showing Draft Content)

IViewerPlugin

Document Solutions Image Viewer - v8.0.0 / IViewerPlugin

Interface: IViewerPlugin

The GcImageViewer allows to extend its behavior and add new functionality using plug-ins.

Example

 // Define class SamplePlugin:
 function SamplePlugin() {
 }
 SamplePlugin.prototype = {
   _onAfterOpenUnregister: null,
   id: "SamplePluginV1",
   initialize: function(viewer) {
     this._onAfterOpenUnregister = viewer.onAfterOpen.register(() => {
       viewer.showMessage("onAfterOpen was called in the SamplePlugin.");
     });
   },
   dispose: function() {
     if(this._onAfterOpenUnregister){
       this._onAfterOpenUnregister();
       delete this._onAfterOpenUnregister;
     }
   }
 }
 
 // Create GcImageViewer and initialize the SamplePlugin:
 var viewer = new GcImageViewer("#viewer");
 viewer.addPlugin(new SamplePlugin());
 viewer.open("https://i.imgur.com/tl0ZsW7.jpeg");

Table of contents

Properties

Methods

Properties

id

id: string

Unique plug-in identifier.

Methods

initialize

initialize(viewer): void

The method is called when the GcImageViewer component is initialized.

Parameters

Name Type
viewer GcImageViewer

Returns

void


dispose

dispose(): void

The method is called when the GcImageViewer component is about to be disposed.

Returns

void