Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WorkspaceAppEventScriptArguments<TData>

Arguments for (workspace) an app script event.

Type parameters

  • TData = any

Hierarchy

Index

Properties

Optional Readonly button

button: StatusBarItem

The underlying button (if available).

Readonly clearTemp

clearTemp: () => boolean

Clears the '.temp' sub folder.

returns

Temp folder has been cleared or not.

Type declaration

    • (): boolean
    • Returns boolean

Optional Readonly data

data: TData

The data.

Readonly event

event: string

The name of the event.

Readonly exists

exists: (path: string) => boolean

Checks if a file or folder exists, relative to '.data' sub folder.

param

The path of the file / folder to check.

returns

Indicates if file / folder exists or not.

Type declaration

    • (path: string): boolean
    • Parameters

      • path: string

      Returns boolean

Readonly extension

extension: ExtensionContext

The underlying extension context.

Readonly getAllWorkspaces

getAllWorkspaces: () => WorkspaceInfo[]

Returns the list of all workspaces.

returns

The list of workspaces.

Type declaration

Readonly getFileResourceUri

getFileResourceUri: (path: string, asString?: boolean) => string | Uri

Returns an URI from the 'resources' directory.

param

The (relative) path.

param

Return as string or object. Default: (true)

returns

The URI.

Type declaration

    • (path: string, asString?: boolean): string | Uri
    • Parameters

      • path: string
      • Optional asString: boolean

      Returns string | Uri

Readonly globalState

globalState: KeyValuePairs<any>

Gets the global state object.

Readonly globalStore

globalStore: Store

The global store.

Readonly globals

globals: any

Global data which are available for all scripts.

Readonly logger

logger: Logger

The logger.

Readonly options

options: any

Options for running the script.

Readonly output

output: OutputChannel

The output channel.

Readonly post

post: (command: string, data?: any) => Promise<boolean>

Posts a command to the web view.

param

The name of the command.

param

The data for the command.

returns

A promise that indicates if operation was successful or not.

Type declaration

    • (command: string, data?: any): Promise<boolean>
    • Parameters

      • command: string
      • Optional data: any

      Returns Promise<boolean>

Readonly readFile

readFile: (path: string) => Buffer

Reads a file, relative to '.data' sub folder.

param

The path of the file.

returns

The read data.

Type declaration

    • (path: string): Buffer
    • Parameters

      • path: string

      Returns Buffer

Readonly readTextFile

readTextFile: (path: string, enc?: string) => string

Reads a file as text, relative to '.data' sub folder.

param

The path of the file.

param

The custom encoding. Default: utf8

returns

The read data.

Type declaration

    • (path: string, enc?: string): string
    • Parameters

      • path: string
      • Optional enc: string

      Returns string

Readonly remove

remove: (path: string) => void

Reads a file or folder, relative to '.data' sub folder.

param

The path of the file / folder.

Type declaration

    • (path: string): void
    • Parameters

      • path: string

      Returns void

Readonly render

render: (source: string, data?: Data) => string

Renders an 'ejs' template.

param

The (template) source.

param

The data for the template.

returns

string The rendered template.

Type declaration

    • (source: string, data?: Data): string
    • Parameters

      • source: string
      • Optional data: Data

      Returns string

Readonly renderFile

renderFile: (file: string, data?: Data) => string

Renders an 'ejs' template from a file.

param

The path to the file with the (template) source.

param

The data for the template.

returns

string The rendered template.

Type declaration

    • (file: string, data?: Data): string
    • Parameters

      • file: string
      • Optional data: Data

      Returns string

Readonly replaceValues

replaceValues: (val: any) => string

Handles a value as string and replaces placeholders.

param

The input value.

returns

The output value.

Type declaration

    • (val: any): string
    • Parameters

      • val: any

      Returns string

Readonly require

require: (id: string) => any

Imports a module from the extension's context.

param

The ID of the module.

returns

The module.

Type declaration

    • (id: string): any
    • Parameters

      • id: string

      Returns any

Readonly stat

stat: (path: string, lstat?: boolean) => false | Stats

Returns file system information of a file or folder, relative to the '.data' sub folder.

param

The path of the item.

param

Use 'fs.lstat()' instead of 'fs.stat()'. Default: (true)

returns

The information or (false) if not found.

Type declaration

    • (path: string, lstat?: boolean): false | Stats
    • Parameters

      • path: string
      • Optional lstat: boolean

      Returns false | Stats

state

state: any

Provides a property to save data permanently while the current (extension) session.

Readonly store

store: Store

The user store for the underlying script.

Readonly tempFile

tempFile: () => string

Creates a new temp file, inside the '.temp' sub folder.

returns

The full path of the new file.

Type declaration

    • (): string
    • Returns string

Readonly toDataPath

toDataPath: (path: string) => string

Returns a full path, relative to the '.data' sub folder.

param

The input path.

returns

The full path.

Type declaration

    • (path: string): string
    • Parameters

      • path: string

      Returns string

Readonly workspaces

workspaces: WorkspaceList

The list of workspaces, grouped by name.

Readonly writeFile

writeFile: (path: string, data: any) => void

Write data to a file, relative to '.data' sub folder.

param

The path of the file.

param

The data write.

Type declaration

    • (path: string, data: any): void
    • Parameters

      • path: string
      • data: any

      Returns void

Generated using TypeDoc