Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting process.hrtime is not a function error when running on Chrome #5

Open
mikemklee opened this issue Nov 25, 2019 · 1 comment

Comments

@mikemklee
Copy link

I am running a React application, so I included the package using yarn add pixl-canvas-plus.

However, when I try to make an instance of the module using var canvasPlus = new CanvasPlus(), I get an error with the following message:

TypeError: process.hrtime is not a function

I believe this is because I am not running on Node.js, but instead running on Chrome.

There seems to be some dependencies that will only work with Node.js.

Any ideas on how to go around this issue? I tried out the demo, and really like it, so it would be awesome if I could actually get it to work in my application.

@jhuckaby
Copy link
Owner

Hello, and sorry for the confusion over this. The library is split into two separate modules: one for Node.js, and one for use in the browser / client. The browser / client library must be loaded differently:

https://github.com/jhuckaby/canvas-plus#browser

So download the canvas-plus.js file from the provided URL, or pull it out of your module distribution that you got from npm, host it on your web server with your app, and load it in your browser using a standard SCRIPT tag:

<script src="canvas-plus.js"></script>

Please note that the client-side library is quite large (750K raw, 180K compressed), due to all the dependencies compiled into that one combo dist file.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants