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

@wearejust/gmaps

v2.8.2

Published

Google Maps wrapper

Downloads

17

Readme

GMaps

Turns an element into Google Maps.

Installation

npm install @wearejust/gmaps

yarn add @wearejust/gmaps

Usage

const GMaps = require('@wearejust/gmaps');

// Turn element into Google Maps
let gmaps = new GMaps(element, options, mapOptions, callback);

// Or use jQuery
$('.gmaps').gmaps(options, mapOptions, callback);

// Remove element
gmaps.destroy();

// Remove only listeners
gmaps.destroy(false);

| Parameter | Value | Default | Description | |---|---|---|---| | element | DOM, string, object | .gmaps | Can be DOM element, selector string or jQuery object | | options | object | null | See Options below | | mapOptions | object | null | See Map Options below | | callback | function | null | Callback when GMaps is initialized |

See examples folder for more details

Options

| Key | Value | Default | Description | |---|---|---|---| | apiKey | string | null | Your Google Maps API key | | cluster | boolean, object | null | Enable Marker Clustering. See used package repository for options. | | fit | boolean | true | Fit all markers on screen | | fitZoom | integer | -1 | Amount to zoom extra after fit | | fitZoomMin | integer | 0 | Minimum zoom after fitZoom | | fitZoomMax | integer | 20 | Maximum zoom after fitZoom | | infowindow | object | null | Object with custom infowindow options. Use the default key to apply as default. | | markers | object | null | Object with keys of custom marker options. Use the default key to apply as default. | | markerEmptyZoom | integer, string | '3' | Amount to zoom in on clicked empty markers. Use integer for fixed level, string to add/subtract current level.| | search | DOM, string, object | null | Search input field to find places on the map | | spread | integer | 0 | Amount to spread markers with the same location |

Map Options

Default Google Maps MapOptions. For more see https://developers.google.com/maps/documentation/javascript/reference#MapOptions

| Key | Default | |---|---| | mapTypeControl | false | | streetViewControl | false | | zoom | 17 |

Events

The jQuery element can have events bound to it.

let gmaps = $('.gmaps').gmaps(options, mapOptions, callback);

gmaps.on('ready', function(e, g) {
  // e is the event
  // g refers to the GMaps object
});

| Event | Description | |---|---| | content_close | After closing the Content of a Marker | | content_open | After opening the Content of a Marker | | destroy | After destroy() is called | | marker_close | After closing a Marker | | marker_highlight | After tabbing through Markers | | marker_mouseout | After hovering out a Marker | | marker_mouseover | After hovering over a Marker | | marker_open | After opening a Marker | | overlay_add | After adding the custom Overlay of a Marker to the map | | overlay_draw | After drawing the custom Overlay of a Marker in the map | | overlay_remove | After removing the custom Overlay of a Marker from the map | | ready | After initialization | | search | After searching | | zoom | After zooming in or out |