Home > @theatre/studio > IStudio

IStudio interface

This is the public api of Theatre's studio. It is exposed through:

Signature:

export interface IStudio 

Example 1

Basic usage:

import studio from '@theatre/studio'

studio.initialize()

Example 2

Usage with **tree-shaking**:

import studio from '@theatre/studio'

if (process.env.NODE_ENV !== 'production') {
  studio.initialize()
}

Properties

Property Type Description
selection Array<ISheetObject<{}> | ISheet> The current selection, consisting of Sheets and Sheet Objects
ui IStudioUI

Methods

Method Description
createContentOfSaveFile(projectId) Creates a JSON object that contains the state of the project. You can use this to programmatically save the state of your projects to the storage system of your choice, rather than manually clicking on the "Export" button in the UI.
createPane(paneClass) Creates a new pane
debouncedScrub(threshhold) Creates a debounced scrub, which is just like a normal scrub, but automatically runs scrub.commit() after threshhold milliseconds have passed after the last scrub.capture.
extend(extension) Registers an extension
getStudioProject() Returns the Theatre.js project that contains the studio's sheets and objects.It is useful if you'd like to have sheets/objects that are present only when studio is present.
initialize(opts) Initializes the studio. Call it once in your index.js/index.ts module. It silently ignores subsequent calls.
onSelectionChange(fn) Calls fn every time the current selection changes.
scrub() Creates a scrub, which is just like a transaction, except you can run it multiple times without creating extra undo levels.
setSelection(selection) Sets the current selection.
transaction(fn) Runs an undo-able transaction. Creates a single undo level for all the operations inside the transaction.Will roll back if an error is thrown.