Class: Context

Oracle® JavaScript Extension Toolkit (JET)
17.1.0

G12196-01

Since:
  • 2.1.0
Module:
  • ojcontext

QuickNav

Description

This is a general purpose context. Initially it only exposes the BusyContext that keeps track of components that are currently animating or fetching data. In the future this context might be expanded for other purposes.


Usage

Typescript Import Format
//This class is exported directly as module. To import it
import Context= require("ojs/ojcontext");

For additional information visit:


The constructor should never be invoked by an application directly. Use oj.Context.getPageContext and oj.Context.getContext APIs to retrieve an instance of the context.

Methods

(static) getContext(node) : {oj.Context}

Returns the closest enclosing JET context for a node. Any DOM element may be designated by the page author as a host of JET context. The designation must be expressed in HTML markup by specifying the "data-oj-context" attribute on the host element:
<div data-oj-context><div>

This method will walk up the element hierarchy starting with the source node to find an element that has the data-oj-context attribute. If no such element is found, the page context will be returned.

If the JET context is established on a particular element, the oj.BusyContext associated with that context will be tracking busy states for that element and its subtree
Parameters:
Name Type Description
node Element DOM element whose enclosing context will be provided
Since:
  • 2.2.0
See:
  • oj.BusyContext for code examples
Returns:

context object scoped per the target node

Type
oj.Context

(static) getPageContext : {oj.Context}

Static factory method that returns the page context.
Since:
  • 2.1.0
See:
  • oj.BusyContext for code examples
Returns:

context scoped for the page

Type
oj.Context

(static) setBusyContextDefaultTimeout(timeout)

Sets a default for the optional timeout argument of the oj.BusyContext#whenReady for all BusyContext instances. The default value will be implicitly used if a timeout argument is not provided.
Parameters:
Name Type Description
timeout number in milliseconds
Since:
  • 6.0.0
See:

getBusyContext : {oj.BusyContext}

Since:
  • 2.1.0
See:
  • oj.BusyContext for code examples
Returns:

busy state context

Type
oj.BusyContext