Chnapy 2019-03-17 13:10:17 +01:00
parent 05438e362f
commit 32225d8a5b
2 changed files with 19 additions and 9 deletions

19
types/vara/index.d.ts vendored
View File

@ -12,7 +12,7 @@
* however they will not override the options set above.
* They will work as secondary options.
*/
export interface TextProperties {
interface TextProperties {
/**
* Size of the text
*/
@ -47,7 +47,7 @@ export interface TextProperties {
letterSpacing?: number;
}
export interface TextStep extends TextProperties {
interface TextStep extends TextProperties {
/**
* Text to be shown
*/
@ -79,7 +79,7 @@ export interface TextStep extends TextProperties {
delay?: number;
}
export interface TextElements {
interface TextElements {
/**
* Array of svg g elements, each representing a letter
*/
@ -91,9 +91,11 @@ export interface TextElements {
container: SVGGElement;
}
export default class Vara {
constructor(queryDom: string, fontJSONSource: string,
textStep: TextStep[], textGlobals?: TextProperties);
declare class VaraType {
constructor(queryDom: string,
fontJSONSource: string,
textStep: TextStep[],
textGlobals?: TextProperties);
/**
* Is used to execute a function when the font is loaded and the elements are created.
@ -153,3 +155,8 @@ export default class Vara {
setPosition(element: SVGGElement, obj: { x?: number; y?: number }, relative?: { x: boolean; y: boolean; }): void;
}
declare const Vara: typeof VaraType;
export = Vara;
export as namespace Vara;

View File

@ -1,4 +1,5 @@
import Vara from 'vara';
import Vara = require('vara');
import * as Vara2 from 'vara';
const vara = new Vara('#root', 'font.json', [
{
@ -35,8 +36,10 @@ const vara = new Vara('#root', 'font.json', [
}
);
const vara2 = new Vara2('#root', 'font.json', []);
// $ExpectType void
vara.ready(() => {});
vara.ready(() => { });
// $ExpectType false | TextElements
vara.get(0);
@ -47,7 +50,7 @@ vara.draw(0);
vara.draw(0, 1000);
// $ExpectType void
vara.animationEnd((id, group) => {});
vara.animationEnd((id, group) => { });
// $ExpectType void
vara.playAll();