Socket
Socket
Sign inDemoInstall

map-promisified

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    map-promisified

Wrapper for Mapbox Gl JS library that gives nice Promise-based API to asynchronous map functions


Version published
Weekly downloads
7.5K
increased by2.22%
Maintainers
1
Install size
21.4 kB
Created
Weekly downloads
 

Readme

Source

map-promisified

Wrapper for Mapbox Gl JS library that gives nice Promise-based API to asynchronous map functions

Usage:

import promisify from 'map-promisified'
import Mapbox from 'mapbox-gl'

const map = new Mapbox.Map({
  // … map properties …
})

// promisify single method:
const flyToPromisified = promisify(map, 'flyTo')

async function flyToPosition () {
  const newPosition = await flyToPromisified([10, 20])
  console.log(newPosition)
  // ⇒ { bearing: 0
  //​      center: Object { lng: …, lat: … },
  //      pitch: 0,
  //      zoom: 9
  //    }
}

// promisify all async map methods:
const actions = promisify(map)

async function flyToPositionAction () {
  const newPosition = await actions.flyTo([10, 20])
  console.log(newPosition)
  // ⇒ { bearing: 0
  //​      center: Object { lng: …, lat: … },
  //      pitch: 0,
  //      zoom: 9
  //    }
}

Promisified methods:

  • setCenter
  • panBy
  • panTo
  • setZoom
  • zoomTo
  • zoomIn
  • zoomOut
  • setBearing
  • rotateTo
  • resetNorth
  • snapToNorth
  • setPitch
  • fitBounds
  • fitScreenCoordinates
  • jumpTo
  • easeTo
  • flyTo

FAQs

Last updated on 08 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc