@opennetwork/environment
TypeScript icon, indicating that this package has built-in type declarations

1.23.0 • Public • Published

@opennetwork/environment

Cross platform JavaScript environment

nycrc config on GitHub 41.56%25 lines covered 41.56%25 statements covered 53.1%25 functions covered 70.6%25 branches covered

Usage

import {run, addEventListener, fetch} from "@opennetwork/environment"; 
import {Response} from "@opennetwork/http-representation";

addEventListener("install", async () => {
   console.log("Setup something!"); 
});

addEventListener("configure", async () => {
    console.log("Updated configuration for something!");
});

addEventListener("fetch", async (event) => {
    event.respondWith(new Response("Not Found", {
        status: 404
    }))
});

addEventListener("execute", async () => {
    const response = await fetch("/something");
    console.log("Response status: ", response.status);
    console.log("Done something!");
});

await run({
    /* config here */
})

Readme

Keywords

none

Package Sidebar

Install

npm i @opennetwork/environment

Weekly Downloads

0

Version

1.23.0

License

MIT

Unpacked Size

2.92 MB

Total Files

753

Last publish

Collaborators

  • shipper
  • virtualstate-user