1.0.9 • Published 9 months ago

@grantcodes/footprint v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Footprint

A small tool to estimate the CO2 output of every resource on a webpage using CO2.js and the performance API.

Installation

npm install @grantcodes/footprint

Usage

import { Footprint } from "@grantcodes/footprint";

const footprint = new Footprint(performance);

// Get an array of all loaded resources. 
const resources = footprint.resources;
resources.foreach(result => console.log(result.name, result.co2));

// Can also get results for a specific category ("media" | "js" | "css" | "html" | "other").
const cssResources = footprint.getByCategory("css");

// And get totals for the resources
console.log(`The ${cssResources.totalBytes} bytes of css resources on this page are estimated to generate ${cssResources.totalCo2} of CO2`);
1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.1

9 months ago

1.0.0

10 months ago