MCPcopy Index your code
hub / github.com/formkit/formkit / createContext

Function createContext

packages/core/src/node.ts:3267–3294  ·  view source on GitHub ↗

* Create a new context object for our a FormKit node, given default information * * @param options - An options object of FormKitOptions | FormKitOptions to override the defaults. * * @returns A FormKitContext | FormKitContext * * @internal

(options: FormKitOptions)

Source from the content-addressed store, hash-verified

3265 * @internal
3266 */
3267function createContext(options: FormKitOptions): FormKitContext {
3268 const value = createValue(options)
3269 const config = createConfig(options.config || {}, options.parent)
3270 return {
3271 _d: 0,
3272 _e: createEmitter(),
3273 uid: Symbol(),
3274 _resolve: false,
3275 _tmo: false,
3276 _value: value,
3277 children: dedupe(options.children || []),
3278 config,
3279 hook: createHooks(),
3280 isCreated: false,
3281 isSettled: true,
3282 ledger: createLedger(),
3283 name: createName(options),
3284 parent: options.parent || null,
3285 plugins: new Set<FormKitPlugin>(),
3286 props: createProps(value),
3287 settled: Promise.resolve(value),
3288 store: createStore(true),
3289 sync: options.sync || false,
3290 traps: createTraps(),
3291 type: options.type || 'input',
3292 value,
3293 }
3294}
3295
3296/**
3297 * Initialize a node object's internal properties.

Callers 3

plugin.tsFile · 0.85
context.tsFile · 0.85
createNodeFunction · 0.85

Calls 10

createEmitterFunction · 0.90
dedupeFunction · 0.90
createLedgerFunction · 0.90
createStoreFunction · 0.90
createValueFunction · 0.85
createHooksFunction · 0.85
createNameFunction · 0.85
createPropsFunction · 0.85
createTrapsFunction · 0.85
createConfigFunction · 0.70

Tested by

no test coverage detected