2.3.1 • Published 1 year ago

@evenbetter/evenbetter-api v2.3.1

Weekly downloads
-
License
CC0-1.0
Repository
-
Last release
1 year ago

EvenBetterAPI Twitter

NPM Version

EvenBetterAPI is a API that is used in EvenBetter.

Here's what you can do with this API:

  • Listen to custom events like: onCaidoLoad, onContextMenuOpen, onPageOpen, onSettingsTabOpen.
  • Create tables and fill it with your data by using the EvenBetterAPI.components.table object.
  • Open and close modals by using the EvenBetterAPI.modal object.

Note

This is not official Caido frontend API. Official Caido frontend API can be found at Caido SDK Frontend. You can use this API in your own Caido frontend plugins.

Installation

You can install EvenBetterAPI by running:

npm i @evenbetter/evenbetter-api

Example

import EvenBetterAPI from "@evenbetter/evenbetter-api";
import { Caido } from "@caido/sdk-frontend";

// Function to generate a page with navigation bar and content
function generatePage(): HTMLElement {
  const body = document.createElement("div");
  body.style.gap = "0.5em";
  body.style.display = "flex";
  body.style.flexDirection = "column";
  
  // Create navigation bar
  const navigationBar = EvenBetterAPI.components.createNavigationBar({
    title: "Example",
    items: [
      { title: "Example", url: "#/example" },
      { title: "Hello", url: "#/hello" },
    ],
  });
  body.appendChild(navigationBar);

  body.appendChild(generateRandomTable());

  return body;
}

const generateRandomRow = () => {
  const row = new Map<string, string>();
  row.set("Name", "Item " + Math.floor(Math.random() * 1000));
  row.set("Value", "Value " + Math.floor(Math.random() * 100));
  row.set("Version", "v" + Math.floor(Math.random() * 10) + ".0");
  row.set("Date", new Date().toLocaleDateString());
  return row;
};

// Generate a table with 20 randomized rows
const generateRandomTable = ()  => {
  const tableData = Array.from({ length: 20 }, () => generateRandomRow());

  const randomTable = EvenBetterAPI.components.table.createTable({
    columns: [
      { name: "Name", width: "15em" },
      { name: "Value", width: "20em" },
      { name: "Version", width: "10em" },
      { name: "Date", width: "10em" },
    ],
    data: tableData,
    height: "500px",
  });
  
  randomTable.style.backgroundColor = "var(--c-bg-subtle)";
  return randomTable;
}

// Register /example and /hello so we can navigate to them
Caido.navigation.addPage("/example", {
  body: generatePage(),
});

Caido.navigation.addPage("/hello", {
  body: generatePage(),
});

// Add an "Example" item to the sidebar
Caido.sidebar.registerItem("Example", "/example");

// Open a modal when Caido is loaded
EvenBetterAPI.eventManager.on("onCaidoLoad", () => {
  EvenBetterAPI.modal.openModal({
    title: "Hello, World!",
    content: "This is a modal",
  });
});

Community

Come join Caido community on Discord. EvenBetter has separate channel #evenbetter. Feel free to ask questions, share your ideas and report bugs :D

2.2.999

1 year ago

2.2.998

1 year ago

2.2.997

1 year ago

2.2.996

1 year ago

2.2.995

1 year ago

2.2.994

1 year ago

2.3.1

1 year ago

2.2.993

1 year ago

2.2.992

1 year ago

2.2.99

1 year ago

2.2.97

1 year ago

2.2.98

1 year ago

2.2.991

1 year ago

2.2.95

1 year ago

2.2.96

1 year ago

2.2.93

1 year ago

2.2.94

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.2.91

1 year ago

2.2.92

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.1.1

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.1.0

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago