# Global blessing variable

[[toc]]

# overview

blessing is aglobally available variable mounted on the window object. The ``blessingvariable itself is an object, which contains some properties, which will be introduced one by one below.

# base_url

TIP

Author's Note: This property name does not conform to the camel case naming convention in JavaScript.

Type: string

The value of this property is the root URL of the current Blessing Skin, and if the Blessing Skin is installed in a subdirectory, it also contains the subdirectory name.

# debug

Type: boolean

Indicates whether it is currently in debug state.

# env

Type: string

Equivalent to APP_ENV.

# fallback_locale

Type: string

WARNING

As of v5.0.0, this attribute has been removed.

If the language of the current environment is not supported by Blessing Skin, this value is the downgraded language.

# locale

Type: string

The language of the current environment.

# site_name

Type: string

Site name.

# timezone

Type: string

server's time zone is determined by the settings in php.ini.

# version

Type: string

The current Blessing Skin version.

# route

Type: string

The Laravel route for the current request.

# extra

Type: any

The data passed from the backend to the frontend by generating JavaScript code on Blade. Different pages have different data.

# i18n

type: object

The text content of front-end internationalization is stored in this object.

# fetch

Type: { [method: string]: (url: string, data?: object) => Promise<object> }

The methods used by Blessing Skin's front-end resource requests are all included. For details, see Front-end resource requests .

# event

Type: { on(eventName: string, listener: Function): void; emit(eventName: string, payload?: object): void }

The methods used to trigger events and listen to events in Blessing Skin's event system, see Event Listener (Frontend) for details .

# notify

Type: { [key: string]: Function }

Currently there are following methods in blessing.notify :

  • showModal