Last active
July 16, 2020 13:56
-
-
Save ddprrt/4b7c370f72908fe84a2afbe81681d91a to your computer and use it in GitHub Desktop.
Resize Observer IDL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ResizeObserverBoxOptions = "border-box" | "content-box" | "device-pixel-content-box"; | |
interface ResizeObserverOptions { | |
box?: ResizeObserverBoxOptions; | |
} | |
interface ResizeObservation { | |
readonly lastReportedSizes: ReadonlyArray<ResizeObserverSize>; | |
readonly observedBox: ResizeObserverBoxOptions; | |
readonly target: Element; | |
} | |
declare var ResizeObservation: { | |
prototype: ResizeObservation; | |
new(target: Element): ResizeObservation; | |
}; | |
interface ResizeObserver { | |
disconnect(): void; | |
observe(target: Element, options?: ResizeObserverOptions): void; | |
unobserve(target: Element): void; | |
} | |
declare var ResizeObserver: { | |
prototype: ResizeObserver; | |
new(callback: ResizeObserverCallback): ResizeObserver; | |
}; | |
interface ResizeObserverEntry { | |
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>; | |
readonly contentBoxSize: ReadonlyArray<ResizeObserverSize>; | |
readonly contentRect: DOMRectReadOnly; | |
readonly devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>; | |
readonly target: Element; | |
} | |
declare var ResizeObserverEntry: { | |
prototype: ResizeObserverEntry; | |
new(): ResizeObserverEntry; | |
}; | |
interface ResizeObserverSize { | |
readonly blockSize: number; | |
readonly inlineSize: number; | |
} | |
declare var ResizeObserverSize: { | |
prototype: ResizeObserverSize; | |
new(): ResizeObserverSize; | |
}; | |
interface ResizeObserverCallback { | |
(entries: ResizeObserverEntry[], observer: ResizeObserver): void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ResizeObserverBoxOptions { | |
"border-box", "content-box", "device-pixel-content-box" | |
}; | |
dictionary ResizeObserverOptions { | |
ResizeObserverBoxOptions box = "content-box"; | |
}; | |
[Exposed=(Window)] | |
interface ResizeObserver { | |
constructor(ResizeObserverCallback callback); | |
void observe(Element target, optional ResizeObserverOptions options); | |
void unobserve(Element target); | |
void disconnect(); | |
}; | |
callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, ResizeObserver observer); | |
[Exposed=Window] | |
interface ResizeObserverEntry { | |
readonly attribute Element target; | |
readonly attribute DOMRectReadOnly contentRect; | |
readonly attribute FrozenArray<ResizeObserverSize> borderBoxSize; | |
readonly attribute FrozenArray<ResizeObserverSize> contentBoxSize; | |
readonly attribute FrozenArray<ResizeObserverSize> devicePixelContentBoxSize; | |
}; | |
interface ResizeObserverSize { | |
readonly attribute unrestricted double inlineSize; | |
readonly attribute unrestricted double blockSize; | |
}; | |
interface ResizeObservation { | |
constructor(Element target); | |
readonly attribute Element target; | |
readonly attribute ResizeObserverBoxOptions observedBox; | |
readonly attribute FrozenArray<ResizeObserverSize> lastReportedSizes; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment