Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: report api #12772

Closed
wants to merge 17 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions report/types/report-renderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ declare module Renderer {
* Flow report uses this to convert `#seo` to `#index=0&anchor=seo`.
*/
onPageAnchorRendered?: (link: HTMLAnchorElement) => void;

/** If defined, the 'Save as Gist' item in the topbar dropdown will be shown and when clicked, will run this function. */
onSaveGist?: (lhr: LH.Result) => string;

/** If defined, when the 'Save/Copy as HTML' items are clicked, this fn will be used instead of `documentElement.outerHTML`. */
getStandaloneReportHTML?: () => string;

/** If defined, renderer will call this when printing is invoked instead of window.print() */
onPrintOverride?: (rootEl: HTMLElement) => Promise<void>;

/** If defined, renderer will call this rather than using a `<a download>.click()>` to trigger a JSON/HTML download. Blob will be either json or html. */
onSaveFileOverride?: (blob: Blob, lhr: LH.Result) => Promise<void>;

/**
* DOM element that will the overlay DOM should be a child of.
* Between stacking contexts and z-index, the overlayParentEl should have a stacking/paint order high enough to cover all elements that the overlay should paint above.
* Defaults to the containerEl, but will be set in PSI to avoid being under the sticky header.
* @see https://philipwalton.com/articles/what-no-one-told-you-about-z-index/ */
overlayParentEl?: HTMLElement;

/** Callback running after a DOM element (like .lh-node or .lh-source-location) has been created */
onDetailsItemRendered?: (
type: LH.Audit.Details['type'],
el: HTMLElement,
value: LH.Audit.Details
) => void;
}
}

Expand Down