Fix lint errors

This commit is contained in:
slikts
2017-04-11 11:16:43 +03:00
parent 90da0812c3
commit 114bb614f3
2 changed files with 34 additions and 36 deletions

View File

@@ -4,11 +4,11 @@ const font = new FontFace("Example", "url(...)", {
});
font.load();
font.loaded.then((fontFace: FontFace) => {
fontFace.status
fontFace.family
fontFace.status;
fontFace.family;
}, (fontFace: FontFace) => {});
const a: boolean = document.fonts.check("12px Example");
const b: boolean = document.fonts.check("12px Example", "ß");
const c: Promise<FontFace[]> = document.fonts.load("12px MyFont", "ß").then();
const d: Promise<typeof document.fonts> = document.fonts.ready.then();
const d: Promise<typeof document.fonts> = document.fonts.ready.then();

View File

@@ -3,61 +3,59 @@
// Definitions by: slikts <https://github.com/slikts>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error'
type FontFaceSetLoadStatus = 'loading' | 'loaded'
type BinaryData = ArrayBuffer | ArrayBufferView
type EventHandler = (event: Event) => void
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error';
type FontFaceSetLoadStatus = 'loading' | 'loaded';
type BinaryData = ArrayBuffer | ArrayBufferView;
type EventHandler = (event: Event) => void;
interface FontFaceDescriptors {
style?: string
weight?: string
stretch?: string
unicodeRange?: string
variant?: string
featureSettings?: string
style?: string;
weight?: string;
stretch?: string;
unicodeRange?: string;
variant?: string;
featureSettings?: string;
}
interface FontFaceSet extends Set<FontFace> {
// events for when loading state changes
onloading: EventHandler
onloadingdone: EventHandler
onloadingerror: EventHandler
onloading: EventHandler;
onloadingdone: EventHandler;
onloadingerror: EventHandler;
// check and start loads if appropriate
// and fulfill promise when all loads complete
load(font: string, text?: string): Promise<FontFace[]>
load(font: string, text?: string): Promise<FontFace[]>;
// return whether all fonts in the fontlist are loaded
// (does not initiate load if not available)
check(font: string, text?: string): boolean
check(font: string, text?: string): boolean;
// async notification that font loading and layout operations are done
readonly ready: Promise<FontFaceSet>
readonly ready: Promise<FontFaceSet>;
// loading state, "loading" while one or more fonts loading, "loaded" otherwise
readonly status: FontFaceSetLoadStatus
readonly status: FontFaceSetLoadStatus;
}
declare global {
interface FontFace {
new (family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors): FontFace
load(): Promise<FontFace>
class FontFace {
constructor(family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors);
load(): Promise<FontFace>;
family: string
style: string
weight: string
stretch: string
unicodeRange: string
variant: string
featureSettings: string
readonly status: FontFaceLoadStatus
readonly loaded: Promise<FontFace>
family: string;
style: string;
weight: string;
stretch: string;
unicodeRange: string;
variant: string;
featureSettings: string;
readonly status: FontFaceLoadStatus;
readonly loaded: Promise<FontFace>;
}
interface Document {
fonts: FontFaceSet
fonts: FontFaceSet;
}
var FontFace: FontFace
}
export {}
export {};