• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

문제 신고

onEnd (SPA API)

통사론

onEnd(function $callback)

상호 작용을 저장하기 전에 SPA 상호 작용과 관련된 값을 변경합니다.

요구 사항

설명

이 호출은 getContext() 과 동일한 객체를 제공합니다. 이것이 호출되면 기록되기 전에 상호 작용을 최종 조정할 수 있습니다. 예를 들어 컨텍스트 값을 기반으로 추가 속성 을 추가할 수 있습니다.

상호 작용을 수정하는 다른 방법은 다음과 같습니다.

매개변수

매개변수

설명

$callback

기능

필수의. 이 함수는 상호 작용이 종료될 때 호출됩니다. 하나의 매개변수로 호출되며, 이는 상호작용 컨텍스트입니다.

반환 값

이 메서드는 interaction() 에서 생성한 것과 동일한 API 객체를 반환합니다.

// router.js
router.addRoute('/dashboard', () => {
const interaction = newrelic.interaction().onEnd(ctx => {
interaction.setAttribute(
'averageChartLoadTime',
ctx.totalChartLoadTime / ctx.chartLoadCount
);
});
getCharts().forEach(loadChart);
});
// chart-loader.js
function loadChart(chart) {
const start = Date.now();
chart.load().then(() => {
const loadTime = Date.now() - start;
interaction.getContext(ctx => {
ctx.totalChartLoadTime = (ctx.totalChartLoadTime || 0) + loadTime;
ctx.chartLoadCount += (ctx.chartLoadCount || 0) + 1;
});
})
}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.