| 58 | // render cycle, which is managed by Mapbox's animation loop. |
| 59 | // This removes the synchronization issue caused by requestAnimationFrame. |
| 60 | redraw() { |
| 61 | const map = this.map; |
| 62 | // map._render will throw error if style does not exist |
| 63 | // https://github.com/mapbox/mapbox-gl-js/blob/fb9fc316da14e99ff4368f3e4faa3888fb43c513 |
| 64 | // /src/ui/map.js#L1834 |
| 65 | if (map.style) { |
| 66 | // cancel the scheduled update |
| 67 | if (map._frame) { |
| 68 | map._frame.cancel(); |
| 69 | map._frame = null; |
| 70 | } |
| 71 | // the order is important - render() may schedule another update |
| 72 | map._render(); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | // External apps can access map this way |
| 77 | getMap() { |