Skip to content

Commit

Permalink
Fix AJAXError import
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlurie committed Oct 28, 2024
1 parent b2d083c commit 0d130e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# MapTiler SDK Changelog

## 2.4.1
### Bug Fixes
- The class `AJAXError` is now imported as part of the `maplibregl` namespace (CommonJS limitation from Maplibre GL JS)

## 2.4.0
### New Features
- Shows a warning message in the map container if WebGL context is lost
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maptiler/sdk",
"version": "2.4.0",
"version": "2.4.1",
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
"module": "dist/maptiler-sdk.mjs",
"types": "dist/maptiler-sdk.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions src/Map.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import maplibregl, { AJAXError } from "maplibre-gl";
import maplibregl from "maplibre-gl";
import { Base64 } from "js-base64";
import type {
StyleSpecification,
Expand Down Expand Up @@ -264,8 +264,8 @@ export class Map extends maplibregl.Map {

// Safeguard for distant styles at non-http 2xx status URLs
this.on("error", (event) => {
if (event.error instanceof AJAXError) {
const err = event.error as AJAXError;
if (event.error instanceof maplibregl.AJAXError) {
const err = event.error as maplibregl.AJAXError;
const url = err.url;
const cleanUrl = new URL(url);
cleanUrl.search = "";
Expand Down

0 comments on commit 0d130e7

Please sign in to comment.