2017-09-25 04:44:56 +01:00
|
|
|
// Interfaces common to the tridactyl project.
|
|
|
|
|
|
|
|
// For some obscure reason, tsc doesn't like .d.ts files to share a name with
|
|
|
|
// .ts files. So don't do that.
|
|
|
|
|
2017-10-28 05:11:10 +01:00
|
|
|
// Ill-advised monkeypatching
|
2017-10-02 00:59:51 +01:00
|
|
|
interface Number {
|
|
|
|
mod(n: number): number
|
2017-10-06 19:22:19 -07:00
|
|
|
clamp(lo: number, hi: number): number
|
2017-10-02 00:59:51 +01:00
|
|
|
}
|
|
|
|
|
2017-09-28 22:39:26 +01:00
|
|
|
// Firefox-specific dom properties
|
2017-09-27 21:10:52 -07:00
|
|
|
interface Window {
|
|
|
|
scrollByLines(n: number): void
|
2017-12-30 07:51:08 +01:00
|
|
|
scrollByPages(n: number): void
|
|
|
|
eval(str: string): any
|
2017-11-16 18:12:18 +00:00
|
|
|
}
|
|
|
|
|
2018-03-03 20:56:54 +01:00
|
|
|
interface HTMLElement {
|
|
|
|
// Let's be future proof:
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
|
|
focus(options: any): void
|
|
|
|
}
|
|
|
|
|
2018-04-13 19:28:03 +01:00
|
|
|
declare function exportFunction(
|
|
|
|
func: Function,
|
|
|
|
targetScope: object,
|
|
|
|
options?: { defineAs?: string; allowCrossOriginArguments?: boolean },
|
|
|
|
): Function
|
2017-12-30 07:51:08 +01:00
|
|
|
|
2017-11-16 18:12:18 +00:00
|
|
|
// Fix typescript bugs
|
|
|
|
interface StringConstructor {
|
2018-04-13 19:28:03 +01:00
|
|
|
toLowerCase(): string
|
2017-11-16 18:12:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-16 14:42:12 +01:00
|
|
|
// Web extension types not in web-ext-types yet
|
2017-10-15 23:05:41 +01:00
|
|
|
declare namespace browser.find {
|
|
|
|
function find(query, object): any
|
|
|
|
}
|
2017-11-15 12:40:26 +00:00
|
|
|
|
|
|
|
// setZoom has an optional first argument of tabId. Unclear how first argument can be optional.
|
|
|
|
declare namespace browser.tabs {
|
2018-04-13 19:28:03 +01:00
|
|
|
function setZoom(zoomFactor: number): Promise<void>
|
|
|
|
function setZoom(tabId: number, zoomFactor: number): Promise<void>
|
|
|
|
function toggleReaderMode(tabId?: number): Promise<void>
|
2017-11-15 12:40:26 +00:00
|
|
|
}
|
2017-11-16 18:12:18 +00:00
|
|
|
|
|
|
|
// html-tagged-template.js
|
2018-04-13 19:28:03 +01:00
|
|
|
declare function html(
|
|
|
|
strings: TemplateStringsArray,
|
|
|
|
...values: any[]
|
|
|
|
): HTMLElement
|