Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/source/load_tilejson.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/source/load_tilejson.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/source/load_tilejson.js
-
curl -L -o load_tilejson.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/source/load_tilejson.js
1.49 kB
| // @flow | |
| import {pick, extend} from '../util/util'; | |
| import {getJSON, ResourceType} from '../util/ajax'; | |
| import browser from '../util/browser'; | |
| import type {RequestManager} from '../util/mapbox'; | |
| import type {Callback} from '../types/callback'; | |
| import type {TileJSON} from '../types/tilejson'; | |
| import type {Cancelable} from '../types/cancelable'; | |
| export default function(options: any, requestManager: RequestManager, callback: Callback<TileJSON>): Cancelable { | |
| const loaded = function(err: ?Error, tileJSON: ?Object) { | |
| if (err) { | |
| return callback(err); | |
| } else if (tileJSON) { | |
| const result: any = pick( | |
| // explicit source options take precedence over TileJSON | |
| extend(tileJSON, options), | |
| ['tiles', 'minzoom', 'maxzoom', 'attribution', 'mapbox_logo', 'bounds', 'scheme', 'tileSize', 'encoding'] | |
| ); | |
| if (tileJSON.vector_layers) { | |
| result.vectorLayers = tileJSON.vector_layers; | |
| result.vectorLayerIds = result.vectorLayers.map((layer) => { return layer.id; }); | |
| } | |
| result.tiles = requestManager.canonicalizeTileset(result, options.url); | |
| callback(null, result); | |
| } | |
| }; | |
| if (options.url) { | |
| return getJSON(requestManager.transformRequest(requestManager.normalizeSourceURL(options.url), ResourceType.Source), loaded); | |
| } else { | |
| return browser.frame(() => loaded(null, options)); | |
| } | |
| } | |