Aller au contenu principal

StartPlaygroundOptions

Index

Properties

optionalblueprint

blueprint?: BlueprintV1

optionalcorsProxy

corsProxy?: string

Proxy URL to use for cross-origin requests.

For example, if corsProxy is set to "https://cors.wordpress.net/proxy.php", then the CORS requests to https://github.com/WordPress/wordpress-playground.git would actually be made to https://cors.wordpress.net/proxy.php?https://github.com/WordPress/wordpress-playground.git.

The Blueprints library will arbitrarily choose which requests to proxy. If you need to proxy every single request, do not use this option. Instead, you should preprocess your Blueprint to replace all cross-origin URLs with the proxy URL.

optionaldetailedProgressCaptions

detailedProgressCaptions?: boolean

Report fine-grained boot captions (runtime download percentage, stall notices, individual WordPress boot steps) through the progress tracker instead of the single "Preparing WordPress" caption. Off by default so existing embedders keep their loading text.

optionaldisableProgressBar

disableProgressBar?: boolean

optionalextensions

extensions?: PHPWebExtension[]

PHP extensions to install before the runtime starts.

optionalgitAdditionalHeadersCallback

gitAdditionalHeadersCallback?: (url: string) => Record<string, string>

Additional headers to pass to git operations. A function that returns headers based on the URL being accessed.


Type declaration

    • (url: string): Record<string, string>
    • Parameters

      • url: string

      Returns Record<string, string>

iframe

iframe: HTMLIFrameElement

optionalmounts

mounts?: MountDescriptor[]

optionalonBlueprintStepCompleted

onBlueprintStepCompleted?: OnStepCompleted

optionalonBlueprintValidated

onBlueprintValidated?: (blueprint: BlueprintV1Declaration) => void

Type declaration

optionalonClientConnected

onClientConnected?: (playground: PlaygroundClient) => void

Called when the playground client is connected, but before the blueprint steps are run.

@returns

Type declaration

optionalpathAliases

pathAliases?: PathAlias[]

Path aliases that map URL prefixes to filesystem paths outside the document root. Similar to Nginx's alias directive.

@example
pathAliases: [
{ urlPrefix: '/phpmyadmin', fsPath: '/tools/phpmyadmin' }
]

optionalprogressTracker

progressTracker?: ProgressTracker

remoteUrl

remoteUrl: string

optionalscope

scope?: string

The string prefix used in the site URL served by the currently running remote.html. E.g. for a prefix like /scope:playground/, the scope would be playground. See the @php-wasm/scopes package for more details. Required in shared mode. Use the same scope for tabs sharing a site and different scopes for independent sites.

optionalsharedWorkerClientVersion

sharedWorkerClientVersion?: string

Build version of the application opening this connection. Defaults to the remote runtime's build version. A mismatch with sharedWorkerVersion requires the tab to reload before connecting. Ignored in dedicated mode.

optionalsharedWorkerVersion

sharedWorkerVersion?: string

Current deployment version used to identify the shared worker and retire a previous build. Defaults to the remote runtime's build version. Ignored in dedicated mode.

optionalshouldInstallWordPress

shouldInstallWordPress?: boolean
@deprecated

Use wordpressInstallMode instead.

Whether to download/install WordPress files. Set this to false when WordPress files are already available, for example from mounts or a saved site.

optionalsqliteDriverVersion

sqliteDriverVersion?: string

The version of the SQLite driver to use. Defaults to the latest development version.

optionalwordpressInstallMode

wordpressInstallMode?: WordPressInstallMode

How to handle WordPress installation. Defaults to download-and-install.

optionalworkerMode

workerMode?: dedicated | shared

Runtime mode. Defaults to dedicated, with one worker per connection. shared connects tabs on the same origin and storage partition to one runtime for the given scope and build. Requires SharedWorker support and an explicit scope. Only the initializing connection runs the startup Blueprint; later connections reuse the initialized site. After initialization, closing one tab does not interrupt other connected tabs.