TypeScript

JavaScript and TypeScript are some of the most popular languages for a web platform.

Install

# NPM
npm install @localess/js-client@latest
# YARN
yarn add @localess/js-client@latest
# PNPM
pnpm add @localess/js-client@latest

Usage

import {localessClient} from "@localess/js-client";

const llClient = localessClient({
  // A fully qualified domain name with protocol (http/https) and port.
  origin: 'https://my-localess.web.app',
  // Localess space ID, cna be found in the Localess Space settings
  spaceId: 'I1LoVe2LocaLess4Rever',
  // Localess API token, can be found in the Localess Space settings
  token: 'Baz00KaT0KeN8S3CureLL' 
});

// Fetch all Content Links
llClient.getLinks()
// Fetch content by SLUG
llClient.getContentBySlug('docs/overview')
// Fetch content by ID
llClient.getContentById('FRnIT7CUABoRCdSVVGGs')
// Fetch translations by locale
llClient.getTranslations('en') 

Listen for Events

Your application can subscribe to the Localess Visual Editor Events :

window.localess.on(['input', 'change'], (event) => {
  if (event.type === 'input' || event.type === 'change') {
    console.log(event.data);
    //Update your content data ...
  }
});

© Copyright 2024 Lessify Rights Reserved. Build with Localess