Giter VIP home page Giter VIP logo

Comments (4)

thearabbit avatar thearabbit commented on July 18, 2024

I tried in server code

TypeError: perfy.start is not a function

from perfy.

onury avatar onury commented on July 18, 2024

I don't know how you transpile your code but perfy is a ES5 package (uses module.export). So it's important how you bundle your project if you're using import.

See this test using babel. This runs the following command to transpile:
npx babel index.js --out-file index-compiled.js --sourceType module --presets=@babel/preset-env

And below works as expected:

import perfy from 'perfy';            // works
// import * as perfy from 'perfy';    // also works
// const perfy = require('perfy');    // also works

perfy.start('test1');
setTimeout(() => {
    const result = perfy.end('test1');
    console.log(result);
}, 1000);

from perfy.

onury avatar onury commented on July 18, 2024

By the way, title of this issue is TypeError: process.hrtime is not a function.
Are you trying to use perfy in a browser environment? If so you can't. perfy is a lib for Node.js. It uses process object which is only available in Node.js (i.e. server side).

from perfy.

thearabbit avatar thearabbit commented on July 18, 2024

Thanks for your reply.
Now work fine on Server Side

from perfy.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.