How to use @elastic/ems-client - 1 common examples

To help you get started, we’ve selected a few @elastic/ems-client 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 elastic / kibana / x-pack / legacy / plugins / maps / public / meta.js View on Github external
export function getEMSClient() {
  if (!emsClient) {
    const isEmsEnabled = chrome.getInjected('isEmsEnabled', true);
    if (isEmsEnabled) {

      const proxyElasticMapsServiceInMaps = chrome.getInjected('proxyElasticMapsServiceInMaps', false);
      const proxyPath = proxyElasticMapsServiceInMaps ? relativeToAbsolute('..') : '';
      const manifestServiceUrl = proxyElasticMapsServiceInMaps ? relativeToAbsolute(`${GIS_API_RELATIVE}/${EMS_CATALOGUE_PATH}`) : chrome.getInjected('emsManifestServiceUrl');

      emsClient = new EMSClient({
        language: i18n.getLocale(),
        kbnVersion: chrome.getInjected('kbnPkgVersion'),
        manifestServiceUrl: manifestServiceUrl,
        landingPageUrl: chrome.getInjected('emsLandingPageUrl'),
        fetchFunction: fetchFunction, //import this from client-side, so the right instance is returned (bootstrapped from common/* would not work
        proxyPath: proxyPath
      });
    } else {
      //EMS is turned off. Mock API.
      emsClient = {
        async getFileLayers() {
          return [];
        },
        async getTMSServices() {
          return [];
        },

@elastic/ems-client

JavaScript client library for the Elastic Maps Service

SEE LICENSE IN LICENSE.txt
Latest version published 6 months ago

Package Health Score

75 / 100
Full package analysis

Popular @elastic/ems-client functions