API Reference
session API
Access and manage the current user’s coding session in the Replit workspace, including active file tracking and change listeners.
The session api provides you with information on the current user’s coding session in the workspace.
Usage
Methods
session.onActiveFileChange
Sets up a listener to handle when the active file is changed
session.getActiveFile
Returns the current file the user is focusing
Types
DisposerFunction
A cleanup/disposer function (void)
OnActiveFileChangeListener
Fires when the current user switches to a different file/tool in the workspace. Returns null if the current file/tool cannot be found in the filesystem.
Was this page helpful?