@mongosh/browser-repl
Browser presentation component for Mongo Shell
Last updated 2 months ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mongosh/browser-repl 
SYNC missed versions from official npm registry.

Browser Repl

React Browser component for Mongo Shell

Usage

import { Shell } from 'mongosh-browser-repl';

export () => {
  return <Shell runtime={runtime} />;
}

Built-in Runtimes

IframeRuntime

Uses an iframe window as sandbox for code execution. NOTE: the execution is not really sandboxed, the top window is accessible.

import { IframeRuntime } from 'mongosh-browser-repl';

const runtime = new IframeRuntime(serviceProvider);

API

<Shell />

Shell is a React component with the following properties:

  • runtime: Runtime: The runtime used to evaluate code.
  • onOutputChanged?: (output: readonly ShellOutputEntry[]) => void: A function called each time the output changes with an array of ShellOutputEntryes.
  • onOutputChanged?: (output: readonly ShellOutputEntry[]) => void: A function called each time the history changes with an array of history entries ordered from the most recent to the oldest entry.
  • onHistoryChanged?: (history: readonly string[]) => void
  • redactInfo?: boolean: If set, the shell will omit or redact entries containing sensitive info from history. Defaults to false.
  • maxOutputLength?: number: The maxiumum number of lines to keep in the output. Defaults to 1000.
  • maxHistoryLength?: number: The maxiumum number of lines to keep in the history. Defaults to 1000.
  • initialOutput?: readonly ShellOutputEntry[]: An array of entries to be displayed in the output area. Can be used to restore the output between sessions, or to setup a greeting message. Note: new entries will not be appended to the array.
  • initialHistory?: readonly string[]: An array of history entries to prepopulate the history. Can be used to restore the history between sessions. Entries must be ordered from the most recent to the oldest. Note: new entries will not be appended to the array.

ShellOutputEntry

An object representing an entry in the shell output, with the following properties:

  • format: 'input' | 'output' | 'error': the type of the entry
  • type?: string: the shell api type if the entry value is a shell api object.
  • value: any: the value that has to be rendered in output.

Current Tags

  • 0.6.1                                ...           latest (2 months ago)

35 Versions

  • 0.6.1                                ...           2 months ago
  • 0.6.0                                ...           2 months ago
  • 0.5.2                                ...           3 months ago
  • 0.5.1                                ...           3 months ago
  • 0.5.0                                ...           3 months ago
  • 0.4.2                                ...           4 months ago
  • 0.4.1                                ...           4 months ago
  • 0.4.0                                ...           4 months ago
  • 0.3.1                                ...           4 months ago
  • 0.3.0                                ...           4 months ago
  • 0.2.2                                ...           5 months ago
  • 0.2.1                                ...           5 months ago
  • 0.2.0                                ...           5 months ago
  • 0.1.0                                ...           6 months ago
  • 0.0.8                                ...           6 months ago
  • 0.0.7                                ...           7 months ago
  • 0.0.6                                ...           7 months ago
  • 0.0.5                                ...           8 months ago
  • 0.0.4                                ...           8 months ago
  • 0.0.3                                ...           8 months ago
  • 0.0.2-alpha.0                                ...           8 months ago
  • 0.0.1                                ...           8 months ago
  • 0.0.1-alpha.19                                ...           8 months ago
  • 0.0.1-alpha.18                                ...           8 months ago
  • 0.0.1-alpha.17                                ...           8 months ago
  • 0.0.1-alpha.15                                ...           8 months ago
  • 0.0.1-alpha.14                                ...           9 months ago
  • 0.0.1-alpha.13                                ...           9 months ago
  • 0.0.1-alpha.12                                ...           9 months ago
  • 0.0.1-alpha.11                                ...           9 months ago
  • 0.0.1-alpha.10                                ...           10 months ago
  • 0.0.1-alpha.6                                ...           10 months ago
  • 0.0.1-alpha.4                                ...           10 months ago
  • 0.0.1-alpha.3                                ...           10 months ago
  • 0.0.1-alpha.2                                ...           10 months ago

Copyright 2014 - 2017 © taobao.org |