Skip to content

Instantly share code, notes, and snippets.

@piotrkubisa
Last active January 25, 2018 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save piotrkubisa/4a1cc7355afcec46651a896d59ec8d50 to your computer and use it in GitHub Desktop.
Save piotrkubisa/4a1cc7355afcec46651a896d59ec8d50 to your computer and use it in GitHub Desktop.
TypeScript declaration file with the NewRelic Browser typings.
// Type definitions for NewRelicBrowser v1026
// Project: https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api
// Definitions by: Piotr Kubisa <https://gist.github.com/piotrkubisa/4a1cc7355afcec46651a896d59ec8d50>
declare var newrelic: NewRelicBrowser;
interface NewRelicBrowser {
addPageAction(name: string, attributes: any): void;
addRelease(release_name: string, release_id: string): void;
addToTrace(custom_object: any): void;
finished(time_stamp: number): void;
noticeError(error: Error): void;
setCustomAttribute(name: string, value: string): void;
setErrorHandler(error: Error, callback: (err: Error) => void): any;
setPageViewName(name: string, host?: string): void;
interaction(): NewRelicBrowserIntegration;
setCurrentRouteName(name: string): void;
}
interface NewRelicBrowserIntegration {
appId: any;
appName: any;
ajaxCount: any;
asn: any;
asnLatitude: any;
asnLongitude: any;
asnOrganization: any;
backendTransactionName: any;
browserInteractionName: any;
category: any;
city: any;
countryCode: any;
deviceType: any;
duration: any;
jsDuration: any;
previousGroupedUrl: any;
previousRouteName: any;
previousURL: any;
regionCode: any;
session: any;
targetGroupedUrl: any;
targetRouteName: any;
targetUrl: any;
timeToConnectStart: any;
timeToConnectEnd: any;
timeToDomComplete: any;
timeToDomContentLoadedEventStart: any;
timeToDomContentLoadedEventEnd: any;
timeToDomInteractive: any;
timeToDomLoading: any;
timeToDomainLookupStart: any;
timeToDomainLookupEnd: any;
timeToFetchStart: any;
timeToLoadEventStart: any;
timeToLoadEventEnd: any;
timeToRedirectStart: any;
timeToRedirectEnd: any;
timeToRequestStart: any;
timeToResponseStart: any;
timeToResponseEnd: any;
timeToSecureConnectionStart: any;
timeToUnloadEventStart: any;
timeToUnloadEventEnd: any;
timestamp: any;
trigger: any;
userAgentName: any;
userAgentVersion: any;
userAgentOS: any;
createTracer(name: string, callback: () => void): NewRelicBrowserIntegration;
end(): NewRelicBrowserIntegration;
getContext(callback: (ctx: NewRelicBrowserIntegration) => void): NewRelicBrowserIntegration;
ignore(): NewRelicBrowserIntegration;
onEnd(callback: (ctx: NewRelicBrowserIntegration) => void): NewRelicBrowserIntegration;
save(): NewRelicBrowserIntegration;
setAttribute(key: string, value: any): NewRelicBrowserIntegration;
setName(name: string, trigger?: string): NewRelicBrowserIntegration;
}
@renehamburger
Copy link

Thanks for these definitions, @piotrkubisa. I've extended your typings and published them at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/new-relic-browser. I didn't check beforehand, but I've included you as one of the authors. Hope that's OK?
The typings can be installed with npm install --save @types/new-relic-browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment