Table of Contents
- API
Odom provides a number of utilities for creating and manipulating components. We are going to look at how each one of these utilities works.
{
createComponent: Function,
$create: Function,
Component: Object,
$C: class,
render: Function,
replaceNode: Function,
assetManager: Object
}
Used to create and transform a component. The function executes processes using values of options
to transform a component.
createComponent(options);
options
- Type:
Object
- Required: Yes.
- Usage: Contains utilities for manipulating a component
- Reference:
options
- Type:
Note: If you create a component directly using
Component
, you have to manipulate the component on your own using theAPI
.
A promise that resolves to an instance of Component
.
An alias for crateComponent
.
The component class. Refer to Component for more information.
An alias for Component;
Used for inserting components into the DOM or component.
render([options]);
options
- Type:
Object
- Required: No.
- Usage: Contains options for rendering assets
- Type:
A promise that resolves to undefined
.
Used to replace a DOM node with another node.
replaceNode(target, node[, replacer])
-
target
:- Type:
Node
- Required: Yes.
- Usage: Replaced by another node.
- Type:
-
node
:- Type:
Node
- Required: Yes.
- Usage: Replaces another node.
- Type:
-
replacer
:- Type:
Function
- Required: No.
- Usage: Replaces
target
withnode
.
- Type:
undefined
Contains utilities used to manage assets. It handles importing, fetching and prefetching of assets.
{
fetchAsset: Function,
importModule: Function,
prefetch: Function,
limitAwait: Function
}
Used to import components. It can be used to import either HTML or JS components.
importComponent(options);
options
- Type:
Object
- Required: Yes.
- Usage: Contains options for importing a component.
- Reference: importComponentOptions.
- Type:
A promise that resolves to a function.
{
file: string,
id: string,
src: string
}
file
:- Type:
string
- Required: No.
- Usage: Contains text for an HTML file that contains an HTML component.
- Type:
id
:- Type:
string
, - Required: No.
- Usage: Contains the ID of the component. This is used for caching and retrieving the component. If not provided, the ID is gotten from one the
meta
element (if provided) of thehead
of the HTML file. src
:- Type:
string
- Required: No.
- Usage: Specifies the location of the component to be imported. It is also used for caching and resolving relative URLs in HTML file components. It must either an absolute URL or root-relative URL (i.e. starts with
/
).
- Type:
- Type: