Created
April 3, 2018 00:59
-
-
Save allthesignals/d9a11b0e69099819d68e84c6cc79ee82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Promise } from 'rsvp'; | |
| import Config from '../../config/environment'; | |
| import MapboxGl from 'mapbox-gl'; | |
| import QUnit from 'qunit'; | |
| MapboxGl.accessToken = Config['mapbox-gl'].accessToken; | |
| export default function createMap() { | |
| return new Promise((resolve) => { | |
| const map = new MapboxGl.Map({ | |
| container: document.createElement('div'), | |
| style: Config['mapbox-gl'].map.style | |
| }); | |
| map.style.once('data', () => resolve(map)); | |
| const onErr = (data) => { | |
| QUnit.onUnhandledRejection((data && data.error) || data || 'Empty error event from mapbox-gl-js'); | |
| }; | |
| map.style.on('error', onErr); | |
| map.on('error', onErr); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment