How to use the @polkadot/ui-settings.on function in @polkadot/ui-settings

To help you get started, we’ve selected a few @polkadot/ui-settings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / apps / packages / react-components / src / i18n.ts View on Github external
'react-components',
      'react-params',
      'react-query',
      'react-signer'
    ],
    keySeparator: false,
    nsSeparator: false,
    react: {
      wait: true
    }
  })
  .catch((error: Error): void =>
    console.log('i18n: failure', error)
  );

uiSettings.on('change', settings => {
  const lang = settings.i18nLang === LANGUAGE_DEFAULT
    ? i18n.services.languageDetector.detect()
    : settings.i18nLang;
  i18n.changeLanguage(lang);
});

export default i18n;
github polkadot-js / extension / packages / extension-ui / src / Popup / index.tsx View on Github external
useEffect((): void => {
    Promise.all([
      subscribeAccounts(setAccounts),
      subscribeAuthorize(setAuthRequests),
      subscribeSigning(setSignRequests)
    ]).catch((error: Error) => console.error(error));

    settings.on('change', ({ camera }): void => setCameraOn(camera === 'on'));

    _onAction();
  }, []);