この機械翻訳は、参考として提供されています。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、このページを参照してください。

問題を作成する

end (SPA API)

構文

newrelic.interaction().end()

現在の時刻でのSPAインタラクションを終了します。

要件

  • ブラウザ Pro+SPA エージェント (v963 以降)

  • npm を使用してブラウザ エージェントをインストールしている場合は、 BrowserAgentクラスをインスタンス化するときにspa機能を有効にする必要があります。features配列に以下を追加します。

    import { Spa } from '@newrelic/browser-agent/features/spa';
    const options = {
    info: { ... },
    loader_config: { ... },
    init: { ... },
    features: [
    Spa
    ]
    }

    詳細については、 npm ブラウザのインストールに関するドキュメントを参照してください。

説明

この SPA メソッドは、現在の時点でのブラウザとの対話を終了します。それ以降のコールバックやリクエストは、SPA インタラクションの一部としては含まれません。

戻り値

このメソッドは、 interaction()によって作成されたものと同じAPIオブジェクトを返します。

router.addRoute('/profile', () => {
startSlowBackgroundAjax(); // Start work that will continue past the end of the interaction
renderProfileComponents().then(() => { // Do work that is part of the interaction
newrelic.interaction().end(); // End the interaction once the important components an the page have finished rendering
});
});