@serenity-is/corelib / ScriptData / ensure
Variable: ensure()
constensure: <TData>(name,dynJS?) =>TData=ensureScriptDataSync
Defined in: src/compat/scriptdata-compat.ts:16
Alias for ensureScriptDataSync. [DEPRECATED] Use ensureScriptDataSync directly.
Synchronous (blocking) version of getScriptData for legacy compatibility. Avoid in new code — it performs a synchronous XHR and blocks the UI thread.
Type Parameters
TData
TData = any
Expected payload type.
Parameters
name
string
Dynamic script name.
dynJS?
boolean
When true loads via ~/DynJS.axd/*.js and evaluates the returned script instead of JSON. Legacy path only.
Returns
TData
The script data (wrapped as Lookup for Lookup.* keys).
Throws
If the hook returns a promise in sync mode or the HTTP request fails.