Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextlua/khaos.js

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextlua/khaos.js

Javascript SDK for Khaos.

  • 0.3.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Khaos.js

Javascript SDK for Khaos.

Usage

With NPM/Yarn

  • npm install --save khaosjs or yarn add khaosjs
  • Initialize library:
import Khaos from "khaosjs";

Khaos.init({
  apiKey: "your-api-key",
  networkOptions: {
    baseApiUrl: "https://api.yourapp.com",
    bodyKeysToRecord: ["isSucceed", "data", "message"],
    headerKeysToRecord: [],
    headersToRedact: [],
    urlBlocklist: [],
    tracingOrigins: [],
  },
  showButton: true,
  appInfo: {},
});

With HTML <script> tag

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    This is an example of a vanilla JS app.

    <script src="dist/index.js"></script>
    <script>
      Khaos.default.init({
        apiKey: "your-api-key",
        networkOptions: {
          baseApiUrl: "https://api.yourapp.com",
          bodyKeysToRecord: ["isSucceed", "data", "message"],
          headerKeysToRecord: [],
          headersToRedact: [],
          urlBlocklist: [],
          tracingOrigins: [],
        },
        showButton: true,
        appInfo: {},
      });
    </script>
  </body>
</html>

API

Khaos.init(options: KhaosInitOptions): void

  • Initializes library and starts monitoring for diagnostic data.

options

  • apiKey: string: (Required) API key provided in Khaos Dashboard.
  • appInfo: KhaosAppInfo (Optional)
    • buildVersion: string: (Optional)
    • appVersion: string: (Optional)
    • appVersionBuild: string: (Optional)
    • appName: string: (Optional)
    • appNameId: string: (Optional)
    • appLanguage: string: (Optional)
    • bundleId: string: (Optional)
  • networkOptions: KhaosNetworkOptions: (Optional) options for network monitoring.
    • baseApiUrl: string: (Required) Your project's base Back-end API URL. Network monitoring won't work unless it is present.
    • bodyKeysToRecord: string[]: (Optional) Overrides bodyKeysToRedact List of HTTP Body keys to be recorded. Other keys will be redacted for security.
    • bodyKeysToRedact: string[]: (Optional) List of HTTP Body keys to be redacted for security (for hiding keys that contain secret keys/tokens).
    • headerKeysToRecord: string[]: (Optional) Overrides headersToRedact, List of only HTTP Headers to be recorded.
    • headersToRedact: string[]: (Optional) List of HTTP Header keys containing secret keys/tokens.
    • urlBlocklist: string[]: (Optional) List of URL's that is unwanted to be monitored.
    • tracingOrigins: string[]: (Optional) List of URL's to be monitored other than baseApiUrl.
  • showButton: boolean: (Optional, default: true) show Khaos button for bug submit form.

Khaos.showForm(): void

Shows bug request form.

Khaos.hideForm(): void

Hides bug request form.

Khaos.toggleForm(): void

Toggles bug request form.

FAQs

Package last updated on 09 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc