mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add favico.js.d.ts
This commit is contained in:
parent
a278148f0e
commit
6d099d3385
68
favico.js/favico.js-tests.ts
Normal file
68
favico.js/favico.js-tests.ts
Normal file
@ -0,0 +1,68 @@
|
||||
/// <reference path="./favico.js.d.ts"/>
|
||||
|
||||
|
||||
// constructor options
|
||||
|
||||
var plain = (): favicojs.Favico => new Favico({
|
||||
});
|
||||
|
||||
var repositioned = (): favicojs.Favico => new Favico({
|
||||
position: 'upleft'
|
||||
});
|
||||
|
||||
var shaped = (): favicojs.Favico => new Favico({
|
||||
type: 'rectangle'
|
||||
});
|
||||
|
||||
var usingCustomFont = (): favicojs.Favico => new Favico({
|
||||
fontFamily: 'FontAwesome',
|
||||
elementId: 'badgefont'
|
||||
});
|
||||
|
||||
var colored = (): favicojs.Favico => new Favico({
|
||||
bgColor: '#5CB85C',
|
||||
textColor: '#ff0'
|
||||
});
|
||||
|
||||
var domBound = (): favicojs.Favico => new Favico({
|
||||
element: document.getElementById('favico')
|
||||
});
|
||||
|
||||
var iconUrlHandler = (url: string): void => {
|
||||
console.log(url);
|
||||
};
|
||||
var withDataUrl = (): favicojs.Favico => new Favico({
|
||||
dataUrl: iconUrlHandler
|
||||
});
|
||||
|
||||
|
||||
var favicons: favicojs.Favico[] = [
|
||||
plain(),
|
||||
repositioned(),
|
||||
shaped(),
|
||||
usingCustomFont(),
|
||||
colored(),
|
||||
domBound(),
|
||||
withDataUrl(),
|
||||
];
|
||||
|
||||
|
||||
// public methods
|
||||
|
||||
favicons.map(favico => {
|
||||
|
||||
// badge
|
||||
favico.badge(2);
|
||||
favico.badge(3, 'slide');
|
||||
favico.badge(3000, {animation: 'none', type: 'rectangle'});
|
||||
favico.reset();
|
||||
|
||||
// image
|
||||
favico.image(document.getElementById('image'));
|
||||
|
||||
// video
|
||||
favico.video(document.getElementById('video'));
|
||||
|
||||
// webcam
|
||||
favico.webcam();
|
||||
});
|
||||
43
favico.js/favico.js.d.ts
vendored
Normal file
43
favico.js/favico.js.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Type definitions for favico.js
|
||||
// Project: http://lab.ejci.net/favico.js/
|
||||
// Definitions by: Yu Matsushita <https://github.com/drowse314-dev-ymat>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module favicojs {
|
||||
|
||||
interface FavicoJsStatic {
|
||||
new (opt?: FavicoJsOptions): Favico;
|
||||
}
|
||||
|
||||
interface FavicoJsOptions {
|
||||
bgColor?: string;
|
||||
textColor?: string;
|
||||
fontFamily?: string;
|
||||
fontStyle?: string;
|
||||
type?: string;
|
||||
position?: string;
|
||||
animation?: string;
|
||||
elementId?: string;
|
||||
element?: HTMLElement;
|
||||
dataUrl?: (url: string) => any;
|
||||
}
|
||||
|
||||
interface Favico {
|
||||
|
||||
badge(number: number): void;
|
||||
badge(number: number, animation: string): void;
|
||||
badge(number: number, opts: FavicoJsOptions): void;
|
||||
|
||||
reset(): void;
|
||||
|
||||
image(imageElement: HTMLElement): void;
|
||||
|
||||
video(imageElement: HTMLElement): void;
|
||||
|
||||
webcam(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare var Favico: favicojs.FavicoJsStatic;
|
||||
Loading…
Reference in New Issue
Block a user