<legend id='g8SAO'><style id='g8SAO'><dir id='g8SAO'><q id='g8SAO'></q></dir></style></legend>

    • <bdo id='g8SAO'></bdo><ul id='g8SAO'></ul>
    <tfoot id='g8SAO'></tfoot>

      <i id='g8SAO'><tr id='g8SAO'><dt id='g8SAO'><q id='g8SAO'><span id='g8SAO'><b id='g8SAO'><form id='g8SAO'><ins id='g8SAO'></ins><ul id='g8SAO'></ul><sub id='g8SAO'></sub></form><legend id='g8SAO'></legend><bdo id='g8SAO'><pre id='g8SAO'><center id='g8SAO'></center></pre></bdo></b><th id='g8SAO'></th></span></q></dt></tr></i><div id='g8SAO'><tfoot id='g8SAO'></tfoot><dl id='g8SAO'><fieldset id='g8SAO'></fieldset></dl></div>

        <small id='g8SAO'></small><noframes id='g8SAO'>

        ReferenceError:使用 performance.now() 时未定义性能

        ReferenceError: performance is not defined when using performance.now()(ReferenceError:使用 performance.now() 时未定义性能)
        <i id='nTqEc'><tr id='nTqEc'><dt id='nTqEc'><q id='nTqEc'><span id='nTqEc'><b id='nTqEc'><form id='nTqEc'><ins id='nTqEc'></ins><ul id='nTqEc'></ul><sub id='nTqEc'></sub></form><legend id='nTqEc'></legend><bdo id='nTqEc'><pre id='nTqEc'><center id='nTqEc'></center></pre></bdo></b><th id='nTqEc'></th></span></q></dt></tr></i><div id='nTqEc'><tfoot id='nTqEc'></tfoot><dl id='nTqEc'><fieldset id='nTqEc'></fieldset></dl></div>
          <tfoot id='nTqEc'></tfoot>

          <legend id='nTqEc'><style id='nTqEc'><dir id='nTqEc'><q id='nTqEc'></q></dir></style></legend>

                • <bdo id='nTqEc'></bdo><ul id='nTqEc'></ul>

                  <small id='nTqEc'></small><noframes id='nTqEc'>

                    <tbody id='nTqEc'></tbody>
                • 本文介绍了ReferenceError:使用 performance.now() 时未定义性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在尝试使用 ReferenceError: performance is not definedPerformance/now" rel="noreferrer">performance.now() 来衡量一个函数调用的执行时间:

                  I am getting an error ReferenceError: performance is not defined when trying to use performance.now() to measure the execution time of a function call:

                  export async function find(someId: string, ctx: context.IContext) {
                  
                        try {
                          var t0 = performance.now();
                  
                          var res = someModel.find(someId, ctx.cookies);
                  
                          var t1 = performance.now();
                          console.log("Call to find took " + (t1 - t0) + " milliseconds.");
                  
                          return res;
                        } catch (err) {
                          console.error(err);
                          throw err;
                        }
                      }
                  

                  有什么办法可以解决这个问题吗?

                  Any ideas how I can fix this?

                  推荐答案

                  我知道这是标记为前端,但如果有人遇到这个寻找 node.js 解决方案(如我),你需要首先要求性能perf_hooks 模块(在节点 8.5+ 中可用).

                  I know this is tagged front-end but if anyone comes across this looking for a node.js solution (like me), you need to first require performance from the perf_hooks module (available in node 8.5+).

                  const {performance} = require('perf_hooks');
                  const t0 = performance.now();
                  ...
                  

                  这篇关于ReferenceError:使用 performance.now() 时未定义性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                  Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                  How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                  How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                  How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                  How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)

                    <small id='NCnjZ'></small><noframes id='NCnjZ'>

                  • <tfoot id='NCnjZ'></tfoot>

                      • <bdo id='NCnjZ'></bdo><ul id='NCnjZ'></ul>
                          <tbody id='NCnjZ'></tbody>

                        <i id='NCnjZ'><tr id='NCnjZ'><dt id='NCnjZ'><q id='NCnjZ'><span id='NCnjZ'><b id='NCnjZ'><form id='NCnjZ'><ins id='NCnjZ'></ins><ul id='NCnjZ'></ul><sub id='NCnjZ'></sub></form><legend id='NCnjZ'></legend><bdo id='NCnjZ'><pre id='NCnjZ'><center id='NCnjZ'></center></pre></bdo></b><th id='NCnjZ'></th></span></q></dt></tr></i><div id='NCnjZ'><tfoot id='NCnjZ'></tfoot><dl id='NCnjZ'><fieldset id='NCnjZ'></fieldset></dl></div>

                          • <legend id='NCnjZ'><style id='NCnjZ'><dir id='NCnjZ'><q id='NCnjZ'></q></dir></style></legend>