gpsi-badge

1.0.3 • Public • Published

GPSI badge

An NPM package that adds a stylable visual indicator of the loading speed rating of the current page. The raiting is provided by Google PageSpeed Insights API.


How it works

An HTML element with style tag is inserted into the DOM and a fetch call is made to PageSpeed API. Once respone is received the value is updated with corresponding score.

How to use it

Via npm

  • install the package with npm install gpsi-badge
  • import gpsiBadge and call gpsiBadge.addNew() inside your code

Via unpkg

{
  mountTo: 'footer', // valid argument for querySelectorAll
  testHost: 'https://valya.codes' // url to be used while doing tests on localhost 
}

Package Sidebar

Install

npm i gpsi-badge

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

15.5 kB

Total Files

11

Last publish

Collaborators

  • valenber