Skip to content

crelte / / CrelteRequest

Type Alias: CrelteRequest

ts
type CrelteRequest = Crelte & object;

This is Crelte a container of useful features and functions.

In svelte contexts for each of these functions and classes there should be a getter function like getCrelte() or getRouter().

Note

Plugins and other instances could modify this type, so when extending cloning or similar use the spread operator instead of naming all "properties".

Type Declaration

req

ts
req: Request;

The current request

site

Get Signature

ts
get site(): Site;

Easy access to this.req.site

Note

The site might not always match with the current route but be the site default site or one that matches the users language.

Returns

Site

getGlobal()

ts
getGlobal<T>(name): T | null;

returns a globalSet

Note

This only works in loadData, in loadGlobalData this will always return null. In that context you should use .getGlobalAsync

Type Parameters

T

T = any

Parameters

name

string

Returns

T | null

getGlobalAsync()

ts
getGlobalAsync<T>(name): T | Promise<T | null> | null;

Get a globalSet and wait until it is loaded

Note

This is only useful in loadGlobalData in all other cases you can use .getGlobal which does not return a Promise

Type Parameters

T

T = any

Parameters

name

string

Returns

T | Promise<T | null> | null