@local-logic/lat-client v2.2.2
Local Logic Location Assessment Tool (LAT)
The @local-logic/lat-client
package allows you to download or preview Local Logic Logic Location Assessment Tool (LAT).
Getting started
Installation
First, install with yarn
, pnpm
, or npm
:
yarn add @local-logic/lat-client
pnpm add @local-logic/lat-client
npm i --save @local-logic/lat-client
Usage
You can now import LatClient
:
import LatClient from "@local-logic/lat-client";
const latClient = LatClient(
"<API_KEY>", {
lat: 45.528130, // Your address latitude
lng: -73.598100, // Your address longitude
addressLabel: "5605 Av. de Gaspé #304, Montreal, Quebec H2T 2A4",
});
You can use the .open()
method.
ℹ️ You should only call this method within an 'click' event handler. Otherwise, this event may be treated as popup events by the browser.
Open Example
const button = document.createElement("button");
button.innerText = "Open Preview";
button.onclick = () => latClient.open();
document.body.appendChild(button);
#### React Example
import { useState } from "react"; import LatClient from "@local-logic/lat-client";
const latClient = LatClient( "<API_KEY>", { lat: 45.52813, // Your address latitude lng: -73.5981, // Your address longitude addressLabel: "5605 Av. de Gaspé #304, Montreal, Quebec H2T 2A4" } );
export default function App() { const downloading, setDownloading = useState(false);
return ( <button onClick={async () => { setDownloading(true); latClient.open(); setDownloading(false); }} disabled={downloading}
>
{downloading ? "Downloading..." : "Download"}
</button>
); }