natestrauser:mapbox

v2.4.0_1Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

nate-strauser:mapbox

Mapbox.js for Meteor apps.

Version matrix:

Mapbox JSMapbox GL
2.4.00.12.1

Install

$ meteor add natestrauser:mapbox

Supported plugins

All plugins listed here are supported:

Usage

Call Mapbox.load() in your client code. Use Mapbox.loaded() to check if it finished loading. This function is reactive.

API

Mapbox.load(opts)

Mapbox.load({
    gl: boolean // optional
    plugins: list // optional
})
  • opts is optional.
  • gl: if true Mapbox GL will be loaded

Examples

// Basic
Meteor.startup(function(){
    Mapbox.load({
        plugins: ['minimap', 'markercluster']
    });
});

Deps.autorun(function () {
  if (Mapbox.loaded()) {
    L.mapbox.accessToken = MY_ACCESS_TOKEN;
    var map = L.mapbox.map('map', MY_MAP_ID);
  }
});


// Using a template's rendered callback
Meteor.startup(function(){
    Mapbox.load();
});

Template.Map.rendered = function () {
    this.autorun(function () {
        if (Mapbox.loaded()) {
            L.mapbox.accessToken = TOKEN;
            var map = L.mapbox.map('map', MAP_ID);
        }
    });
};