Namespaces API¶
Each snippet installed configures a set of SDK modules and plugins that live within a namespace. The namespace is an isolated environment for a SDK configuration to live in.
The namespace provides an API for plugins and modules to use. This API can also be called from the Bootloader for certain specific commands.
General Methods¶
Namespaces provide multiple methods for interfacing with the SDK:
name
¶
name (): string
The name of the namespace. This is an easy way to check what namespace your code is in, if needed.
version
¶
version (): string
The version of the namespace. This is effectively the version of the SDK modules that are loaded.
bootloader
¶
namespace.bootloader();
bootloader (): Scope
You can access the bootloader's full functionality through this method. Some
methods that aren't public are available through the namespace's bootloader
method.
logger
¶
This method returns the logger. This is extremely helpful because:
- it plugs directly into the debugger
- it keeps the logs out of the browser console
- it enables log level management
Please use the logger whenever you want to print out logs when using the Web SDK.
require
, provide
¶
These methods are used in conjunction to request and provide different resources to the SDK. These can be plugins, templates, services, and more.
To require
something, you need to provide the type of resource, and a set of
parameters like name
and config
:
// Usage
namespace.require(type, parameters);
// Example
namespace.require('template', { name: 'popup', config: {}, ... });
To provide
something, you need to provide the type of the resource, and a set
of parameters llike name
and constructor
:
// Usage
namespace.provide(type, parameters);
// Example
namespace.provide('template', { name: 'popup', constructor: function() { ... }, ... });
Parameter | Type | Required | Description |
---|---|---|---|
type | string | no | The type of resources requested |
parameters | object | no | Additional parameters for the requested resource |
plugins
, pluginDetails
¶
These methods provide you with the plugins the namespace has dealt with.
You can use the plugins
method to get a list of instantiated plugins.
namespace.plugins();
You can use the pluginDetails
to get more information on all plugins, whether they just be
provided, required, or some mismatch of more states. It's very useful for
debugging.
namespace.pluginDetails();
services
¶
This method gets you a list of instantiated services available in the namespace.
Modules¶
The Web SDK gets most of its core functionality through its modules. Each module is a set of calls that enhance some browser or website functionality. Modules are managed and loaded by namespaces and made available to all plugins and services.
datastore
¶
The datastore
module manages different datastores in the browser. Whether
data is stored in cookies, local storage, or the back end, this plugin can
manage its content and access.
event
¶
The event
module manages all events in the Web SDK, whether these are for the
datalayer, pub/sub, or datastores. In order to fire events to Orbee, the event
module is what you should use.
lit
¶
The lit
module is simple -- it provides the
Lit HTML library to the browser.
network
¶
The network
module manages the network usage on the browser. You can choose
your throttle rates, network capabilities to use, and caching capabilities.
site
¶
The site
module manages anything site-related going on. Whether it's event
listeners or site plugins, this module will keep track of the listeners and
added content on the website.
Plugins¶
The Web SDK also ships with a list of default plugins to bring additional functionality to the browser. These plugins bring product-based features to the browser like DNI, activity tracking, third-party integrations and more.