Javascript UI kit options

Typically, adding the JS UI kit to your application or website is enough to get you started. But you probably want to tweak the default options a bit to make your Weavy behave the way you want it to.

Using options

Specify options by passing an object with properties when constructing the Weavy instance. You may pass several objects with options to the constructor that will be merged. This means you can have common options in one object and another object with specific options.

Weavy.url = 'https://weavy-server.example'
Weavy.tokenFactory = async (refresh) => '{server_provided_access_token}' = 'America/Los_Angeles'

You may also define the options using HTML.

  token-factory="async (refresh) => '{server_provided_access_token}'"

The minimum required options to get started is to specify the url to the Weavy environment and a tokenFactory async function to provide authentication from your backend.

Option Type Description
tokenFactory * function async function returning a string access token for authentication from the backend.
tz string IANA Timezone identifier, e.g. America/Los_Angeles. When specified, sets the timezone to use when rendering dates and times.
url * URL Url to your Weavy environment.

* Required options

Default options for apps

You may configure default options, used when instantiating any apps. The options are stored in an object as a property called Weavy.defaults. You can read or set these options before you create a new app. The defaults will be applied on all Weavy app instances unless other options are specified.

Weavy.defaults.className: "wy-dark";
Weavy.defaults.css: ":root { --wy-theme-color: #ff0000; }";

// The app will use the default className and css properties
var messenger = new Messenger();
Weavy Docs