DefinitelyTyped/types/diva.js/diva.js-tests.ts
Juliette Regimbal b7a07d95dd [diva.js] Add types for diva.js (#37803)
* Initial commit autogenerated with dts-gen

* Add public functions to Diva class

* Add Settings definition.

* First attempt at adding Events

* Apply linting, fix default export to include class and Events

* Simple tests

Ensure the Diva class constructor exists along with the Events class.
Check that Diva class functions work.

* Move interfaces to separate file.

* Set members of Diva class.

* Add Region and Dimensions interfaces.

* Add definition for Viewport class

* Add Offset interface

* Add DocumentLayout class

* Move interfaces to interfaces.d.ts

* Add types for Renderer class

* Add ViewerCore class types, use in index.d.ts

* Move Settings type declaration to interfaces.d.ts

* Add settings member to Diva

* Change ViewerState.renderer type from object to Renderer

* Type of ViewerState.viewport from object to Viewport

* Use global import in tests.

* Add ImageManifest class.

* Replace XMLHttpRequest with Promise<Response>

Diva.js uses fetch(), which returns a Promise<Response>.

* Add types for the ViewHandler

* Properly type members of Viewport
2019-12-10 15:32:58 -05:00

15 lines
443 B
TypeScript

import Diva from 'diva.js';
import { Settings } from 'diva.js/interfaces';
function TestDiva(): void {
const diva = new Diva('diva-wrapper', {
objectData: 'manifest.json',
});
diva.activate();
Diva.Events.subscribe('ObjectDidLoad', () => {}, diva.getSettings().ID);
diva.disableDragScrollable();
const pageIndex: number = diva.getActivePageIndex();
let settings: Settings = diva.settings;
settings = diva.getSettings();
}