Comment on page
Page context
The
currentPage
variable is dynamically injected into your script, adapting its type based on the context in which the script is running.For example, if your script runs on a Collection Page, currentPage
will have all the properties and methods specific to CollectionPageContext
.const currentPage: CollectionPageContext | CustomPageContext | FormPageContext
interface PageContext {
get title(): string;
get badge(): string;
get isHidden(): boolean;
}
Each specific context type, such as
CollectionPageContext
, extends the base PageContext and adds its own unique properties and methods.For example, when running a script on a Collection Page, currentPage will inherit all properties and methods defined in CollectionPageContext.
Last modified 1mo ago