Home > scrubbr > Scrubbr > setGlobalContext

Scrubbr.setGlobalContext() method

Set the global context object, that will be automatically merged with the context passed to the serialize function. You can use this for setting things like the logged-in user, at a global level.

Signature:

setGlobalContext(context: ContextObject, merge?: boolean): ContextObject;

Parameters

Parameter Type Description
context ContextObject Any object you want to set as the context.
merge boolean Automatically merge this context with the existing global context (defaults false) Otherwise, the global context will be overwritten.

Returns:

ContextObject