@polkadot/ui-settings
TypeScript icon, indicating that this package has built-in type declarations

3.6.6 • Public • Published

@polkadot/ui-settings

Manages app settings including endpoints, themes and prefixes

Usage Examples

User preferences are set as a settings object in the browser's local storage.

import settings from '@polkadot/ui-settings';

render () {
  // get api endpoint for the selected chain
  const WS_URL = settings.apiUrl();

  // get the selected il8n language
  const language = settings.il8nLang();

  // get all available il8n languages
  const languages = settings.availableLanguages();

  // update settings
  const updatedSettings = {
    ...settings,
    i18nLang: 'Arabic'
  }
  settings.set(updatedSettings);

  // NOTE: API currently does not handle hot reconnecting properly,
  so you need to manually reload the page after updating settings.
  window.location.reload();
}

Used by

Apps that currently use the settings package

Dependencies (5)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @polkadot/ui-settings

    Weekly Downloads

    15,024

    Version

    3.6.6

    License

    Apache-2.0

    Unpacked Size

    92.3 kB

    Total Files

    47

    Last publish

    Collaborators

    • polkadotjs
    • jacogr