Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace R

R stands for Register

These functions can only be called in plugins' register() function.

Index

Functions

Config

  • Register a configuration option.

    Parameters

    • key: string

      config key

    • options: ConfigOption

      See ConfigOption

      NOTE: options.validator will only notify user about invalid value. It wouldn't stop user from saving invalid value.

    Returns void

Contributor

  • Contributor(name: string, link?: string): void
  • Register a contributor.

    Contributors will show up in WebUI.

    Parameters

    • name: string

      Contributor's name

    • Optional link: string

      Contributor's homepage

    Returns void

DataFile

  • DataFile(path: string, options?: FileOption): void
  • Register a data file upload entry.

    Parameters

    • path: string

      a path (with filename) where the uploaded file will be saved to.

    • Optional options: FileOption

    Returns void

GameCode

  • GameCode(code: string): void
  • Register a target game code to your plugin for checking savedata.

    You should only call this from your plugin's register() function.

    Parameters

    • code: string

      Model code of your target machine, usually three capital letters

    Returns void

Route

  • Register your custom route.

    You should only call this from your plugin's register() function.

    Parameters

    • method: string

      Method name of your target route, usually looks like "module.get"

    • handler: EamusePluginRoute | boolean

      Your custom route function/method following the type EamusePluginRoute. A boolean can be passed if you don't need any processing: - true: Sending empty response with status code 0 - false: Sending empty response with status code 1

    Returns void

Unhandled

  • Register all unhandled routes for a game.

    You should only call this from your plugin's register() function.

    Parameters

    • Optional handler: EamusePluginRoute

      Your custom route function/method following the type EamusePluginRoute. If undefined, the router will apply a default handler that prints method names.

    Returns void

WebUIEvent

  • WebUIEvent(event: string, callback: (data: any) => void | Promise<void>): void
  • Register a WebUI event callback

    Which can be called in WebUI using emit(event) function or a post message to /emit/<event>

    Callback can be async function if you want to use await for your DB operations.

    Parameters

    • event: string
    • callback: (data: any) => void | Promise<void>
        • (data: any): void | Promise<void>
        • Parameters

          • data: any

          Returns void | Promise<void>

    Returns void

Generated using TypeDoc