Index

Type aliases

MessageCommand

MessageCommand: "version" | "run" | "read" | "write" | "temp" | "mkdir" | "eval" | "getconfig" | "env"

Variables

NATIVE_NAME

NATIVE_NAME: "tridactyl" = "tridactyl"

logger

logger: Logger = new Logger("native")

Functions

editor

  • editor(file: string, content?: string): Promise<MessageResp>

ffargs

  • ffargs(): Promise<string[]>
  • This returns the commandline that was used to start firefox. You'll get both firefox binary (not necessarily an absolute path) and flags

    Returns Promise<string[]>

firstinpath

  • firstinpath(cmdarray: any): Promise<any>

getBestEditor

  • getBestEditor(): Promise<string>

getNativeMessengerVersion

  • getNativeMessengerVersion(quiet?: boolean): Promise<number>

getPref

  • getPref(name: string): Promise<string>
  • Returns the value for the corresponding about:config setting

    Parameters

    • name: string

    Returns Promise<string>

getPrefs

  • getPrefs(): Promise<object>
  • Returns a promise for an object that should contain every about:config setting. If performance is slow, it might be a good idea to cache the results of this function: the preference files do not change while firefox is running.

    Returns Promise<object>

getProfileDir

  • getProfileDir(): Promise<string>

getenv

  • getenv(variable: string): Promise<string>

getrc

  • getrc(): Promise<string>

inpath

  • inpath(cmd: any): Promise<boolean>

loadPrefs

  • loadPrefs(filename: any): Promise<object>
  • When given the name of a firefox preference file, will load said file and return a promise for an object the keys of which correspond to preference names and the values of which correspond to preference values. When the file couldn't be loaded or doesn't contain any preferences, will return a promise for an empty object.

    Parameters

    • filename: any

    Returns Promise<object>

mkdir

  • mkdir(dir: string, exist_ok: boolean): Promise<MessageResp>

nativegate

  • nativegate(version?: string, interactive?: boolean, desiredOS?: string[]): Promise<Boolean>
  • Used internally to gate off functions that use the native messenger. Gives a helpful error message in the command line if the native messenger is not installed, or is the wrong version.

    arg

    version: A string representing the minimal required version.

    arg

    interactive: True if a message should be displayed on version mismatch.

    Parameters

    • Default value version: string = "0"
    • Default value interactive: boolean = true
    • Default value desiredOS: string[] = ["mac", "win", "linux", "openbsd"]

    Returns Promise<Boolean>

    false if the required version is higher than the currently available native messenger version.

parsePrefs

  • parsePrefs(prefFileContent: string): Promise<object>

pyeval

  • Evaluates a string in the native messenger. This has to be python code. If you want to run shell strings, use run() instead.

    Parameters

    • command: string

    Returns Promise<MessageResp>

read

run

sendNativeMsg

temp

  • temp(content: string, prefix: string): Promise<MessageResp>

write

  • write(file: string, content: string): Promise<MessageResp>

writePref

  • writePref(name: string, value: any): Promise<void>
  • Writes a preference to user.js

    Parameters

    • name: string
    • value: any

    Returns Promise<void>