Libraries
The Core WireBootstrap library as well as all components and related files are normally retrieved from the NPM registry and stored in the node_modules
folder off the root of the theme project.
Theme Libraries
Component libraries, TypeScript definition files, and other related files specific to a theme are located off the root of a theme project in the \libs
directory.
Types
To be sure all WireBootstrap Typescript declaration files can be found by a project's compiler, the path to the@wirebootstrap
scope root directory is registered in the compilerOptions.typeRoots
attribute inside the project's tsconfig.json
file.
{
"compilerOptions": {
...
"typeRoots": [
"./node_modules/@wirebootstrap",
"./node_modules/@types"
]
}
}
When a custom typeRoots
is specified, be sure to replace the original default that points to the @types
directory as seen above.
Wire
All Web components and services published by WireBootstrap are created off of the global wire
JavaScript object located in the core WireBootstrap library wire.js
. Many create a sub namespace and then adds classes, interfaces, and other structures to support a given component or service. This is similar in design to how all jQuery plugins attach to the root jQuery
object.
The example below creates a new WireBootstrap DataTable and binds it to an instance of the Bootstrap Select component.
const table = new wire.data.DataTable(...);
const select = new wire.bsSelect().render({
data: table
...
});
IWire
In TypeScript, all root types, classes, interfaces, and other structures native to the core WireBootstrap JavaScript API begin with IWire
.
The following example casts a raw JavaScript object into a WireBootstrap data table by referencing the IWireDataTable
interface.
const data: any = { ... };
const table = data as IWireDataTable;
Last updated
Was this helpful?