npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dgtek-portal-map-package

v1.4.8

Published

This package draws DGtek footprint polygons & checks the address to be in the footprint. This package provides a number of methods for creating, searching and updating the buildings data in DB. Uses web-worker, remote and local DB. For DGtek provisionin

Downloads

21

Readme

dgtek-portal-map-package

:clipboard: Installation

yarn add dgtek-portal-map-package && mv node_modules/dgtek-portal-map-package/dist/map.worker.js public

or

npm install dgtek-portal-map-package && mv node_modules/dgtek-portal-map-package/dist/map.worker.js public

:clipboard: How to use

:page_with_curl: Configuring web-worker

You need to start web-worker.

Import the module startWorker from package:

import { startWorker } from 'dgtek-portal-map-package/dist/start-worker'

and then start the worker:

const worker = startWorker(publicPath, apiHost, apiAccessKey, credentials, role, callback)
  • publicPath is the path worker will be started from (required)
  • apiHost is the backend API url (for example https://dgtek-staging.herokuapp.com) (required)
  • apiAccessKey is needed to access backend API (required)
  • credentials user credentials (required)
  • role - user role (optional)
  • callback - your function that will receive the message when web-worker will be ready to work (optional)

:page_with_curl: Methods

After the worker will be created you can use it's methods to access the data

Each method receive callback to return the result (your function )

• refresh(callback)
• getBuildingsListForTable(status, callback) /* available status: lit, footprint, build, soon, other */
• getBuildingsList(status, callback) /* available status: lit, footprint, build, soon, other */
• getBuildingsByList(list, callback) /* list - array of buildings id */
• getMasterBuildingsList(callback) /* lit only */
• getSlavesForMaster(masterId, callback)
• getBuildingDetailsById(buildingId, callback) /* callback will receive building details */
• getBuildingDetailsByAddress(address, callback) /* callback will receive building details */
• createNewBuilding(data, callback) /* callback will receive the id of created building */
• deleteBuilding(buildingId, callback)
• patchBuildingDetails(buildingId, data, callback)
• putBuildingDetails(buildingId, data, callback)

☕ Example

const callback = data => console.log(data)

worker.getBuildingsList('lit', callback)

:memo: Package

Import package:

import DgtekMap from 'dgtek-portal-map-package'

Create container for map with id "container-for-map" and stylize it as you need:

<style>
  #container-for-map {
    position: relative;
    width: 70%;
    height: 70vh;
    margin: auto;
  }
  @media screen and (max-width: 600px) {
    #container-for-map {
      width: 100%;
    }
  }
</style>
<main>
  <figure id="container-for-map"></figure>
</main>

:clipboard: Get started

const map = new DGtekMap({
  container,
  center: { lat: -37.8357725, lng: 144.9738764 }
})

:clipboard: Catch search event

To receive the result of user input you should set the property searchCallback of worker:

worker.searchCallback = function (data) {
  console.log('SEARCH CALLBACK DATA:\n', data)
}