thegreenwebfoundation / co2.js

An npm module for accessing the green web API, and estimating the carbon emissions from using digital services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test compatibility of CO2.js in with other js runtimes

mrchrisadams opened this issue · comments

One of the goals we had for CO2.js, and one of the reasons we invested a bunch of time in making it work as a hybrid library was to support a wide number of runtimes.

We currently support the nodejs runtime, and most modern browsers, but there are other runtimes that use javascript too.

Some examples below:

Re: Deno - They are planning to have more seamless NPM & Node interoperability in the next couple of months.
https://deno.com/blog/changes#compatibility-with-node-and-npm

Untested yet, but we should be good in Deno as of 1.28

https://deno.com/blog/v1.28

This will be good to eventually have documented on the docs site, but we'll keep a rolling list here for now.

  • Deno
  • Elsa
  • Bun
  • Appscript
  • Cloudflare Workers

Here's a working demo in Deno:
https://github.com/fershad/co2js-deno-demo

Here's a working demo in Bun
https://github.com/fershad/co2js-bun-demo