Skip to content

germsb/meteor-mapbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pauloborges:mapbox

Mapbox.js for Meteor apps.

Version matrix:

Mapbox JS Mapbox GL
2.2.3 0.12.1

Install

$ cd to/my/meteor/project
$ meteor add pauloborges:mapbox@2.2.3_2

or (if you want to modify the code):

$ cd to/my/meteor/project
$ mkdir packages # ensure that packages folder exists
$ git clone https://github.com/pauloborges/meteor-mapbox.git packages/pauloborges:mapbox
$ meteor add pauloborges: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);
        }
    });
};

About

Mapbox.js for Meteor apps

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 74.0%
  • HTML 15.3%
  • CSS 10.7%