Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FileBrowserModel

An implementation of a file browser model. The namespace for the FileBrowserModel class statics.

Notes

All paths parameters without a leading '/' are interpreted as relative to the current directory. Supports '../' syntax.

Hierarchy

  • FileBrowserModel

Implements

  • IDisposable

Index

Constructors

constructor

Properties

Private _connectionFailure

_connectionFailure: Signal<this, Error> = new Signal<this, Error>(this)

Private _driveName

_driveName: string

Private _fileChanged

_fileChanged: Signal<this, IChangedArgs> = new Signal<this, Contents.IChangedArgs>(this)

Private _isDisposed

_isDisposed: boolean = false

Private _items

_items: IModel[] = []

Private _key

_key: string = ""

Private _model

_model: IModel

Private _pathChanged

_pathChanged: Signal<this, IChangedArgs<string>> = new Signal<this, IChangedArgs<string>>(this)

Private _paths

_paths: Set<string> = new Set<string>()

Private _pending

_pending: Promise<void> | null = null

Private _pendingPath

_pendingPath: string | null = null

Private _poll

_poll: Poll

Private _refreshed

_refreshed: Signal<this, void> = new Signal<this, void>(this)

Private _restored

_restored: PromiseDelegate<void> = new PromiseDelegate<void>()

Private _sessions

_sessions: IModel[] = []

Private _state

_state: IStateDB | null = null

Private _unloadEventListener

_unloadEventListener: function

Type declaration

    • (e: Event): string
    • Parameters

      • e: Event

      Returns string

Private _uploadChanged

_uploadChanged: Signal<this, IChangedArgs<IUploadModel>> = new Signal<this, IChangedArgs<IUploadModel>>(this)

Private _uploads

_uploads: IUploadModel[] = []

manager

manager: IDocumentManager

The document manager instance used by the file browser model.

Accessors

connectionFailure

  • get connectionFailure(): ISignal<this, Error>
  • A signal emitted when the file browser model loses connection.

    Returns ISignal<this, Error>

driveName

  • get driveName(): string
  • The drive name that gets prepended to the path.

    Returns string

fileChanged

  • get fileChanged(): ISignal<this, IChangedArgs>
  • Get the file path changed signal.

    Returns ISignal<this, IChangedArgs>

isDisposed

  • get isDisposed(): boolean
  • Get whether the model is disposed.

    Returns boolean

path

  • get path(): string
  • Get the current path.

    Returns string

pathChanged

  • get pathChanged(): ISignal<this, IChangedArgs<string>>
  • A signal emitted when the path changes.

    Returns ISignal<this, IChangedArgs<string>>

refreshed

  • get refreshed(): ISignal<this, void>
  • A signal emitted when the directory listing is refreshed.

    Returns ISignal<this, void>

restored

  • get restored(): Promise<void>
  • A promise that resolves when the model is first restored.

    Returns Promise<void>

specs

  • get specs(): ISpecModels | null
  • Get the kernel spec models.

    Returns ISpecModels | null

uploadChanged

  • get uploadChanged(): ISignal<this, IChangedArgs<IUploadModel>>

Methods

Private _handleContents

  • _handleContents(contents: IModel): void
  • Handle an updated contents model.

    Parameters

    • contents: IModel

    Returns void

Private _onFileChanged

  • _onFileChanged(sender: IManager, change: IChangedArgs): void
  • Handle a change on the contents manager.

    Parameters

    • sender: IManager
    • change: IChangedArgs

    Returns void

Private _onRunningChanged

  • _onRunningChanged(sender: IManager, models: IterableOrArrayLike<IModel>): void
  • Handle a change to the running sessions.

    Parameters

    • sender: IManager
    • models: IterableOrArrayLike<IModel>

    Returns void

Private _populateSessions

  • _populateSessions(models: IterableOrArrayLike<IModel>): void
  • Populate the model's sessions collection.

    Parameters

    • models: IterableOrArrayLike<IModel>

    Returns void

Private _shouldUploadLarge

  • _shouldUploadLarge(file: File): Promise<boolean>
  • Parameters

    • file: File

    Returns Promise<boolean>

Private _upload

  • _upload(file: File, chunked: boolean): Promise<IModel>
  • Perform the actual upload.

    Parameters

    • file: File
    • chunked: boolean

    Returns Promise<IModel>

Private _uploadCheckDisposed

  • _uploadCheckDisposed(): Promise<void>

cd

  • cd(newValue?: string): Promise<void>
  • Change directory.

    Parameters

    • Default value newValue: string = "."

    Returns Promise<void>

    A promise with the contents of the directory.

dispose

  • dispose(): void
  • Dispose of the resources held by the model.

    Returns void

download

  • download(path: string): Promise<void>
  • Download a file.

    Parameters

    • path: string

      The path of the file to be downloaded.

    Returns Promise<void>

    A promise which resolves when the file has begun downloading.

items

  • items(): IIterator<IModel>
  • Create an iterator over the model's items.

    Returns IIterator<IModel>

    A new iterator over the model's items.

refresh

  • refresh(): Promise<void>
  • Force a refresh of the directory contents.

    Returns Promise<void>

restore

  • restore(id: string): Promise<void>
  • Restore the state of the file browser.

    Parameters

    • id: string

      The unique ID that is used to construct a state database key.

    Returns Promise<void>

    A promise when restoration is complete.

    Notes

    This function will only restore the model once. If it is called multiple times, all subsequent invocations are no-ops.

sessions

  • sessions(): IIterator<IModel>
  • Create an iterator over the active sessions in the directory.

    Returns IIterator<IModel>

    A new iterator over the model's active sessions.

upload

  • upload(file: File): Promise<IModel>
  • Upload a File object.

    Parameters

    • file: File

      The File object to upload.

    Returns Promise<IModel>

    A promise containing the new file contents model.

    Notes

    On Notebook version < 5.1.0, this will fail to upload files that are too big to be sent in one request to the server. On newer versions, it will ask for confirmation then upload the file in 1 MB chunks.

uploads

  • Create an iterator over the status of all in progress uploads.

    Returns IIterator<IUploadModel>

Generated using TypeDoc