
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@amap/amap-jsapi-loader
Advanced tools
amap-jsapi-loader 是高德开放平台官网提供的地图 JSAPI 的加载器,可帮助开发者快速定位、有效避免加载引用地图 JSAPI 各种错误用法。
该加载器具有以下特性:
AMapLoader.load({
"key": "", // 申请好的Web端开发者Key,首次调用 load 时必填
"version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
"plugins": [] // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}).then((AMap)=>{});
参考 example/example.html
<script src="https://webapi.amap.com/loader.js"></script>
<script>
AMapLoader.load({
key:'',//首次load必填
version:'2.0',
plugins:['AMap.Scale']
}).then((AMap)=>{
map = new AMap.Map('container');
map.addControl(new AMap.Scale())
}).catch((e)=>{
console.error(e);
});
</script>
安装
tnpm i @amap/amap-jsapi-loader --save-dev
使用
import AMapLoader from '@amap/amap-jsapi-loader';
AMapLoader.load().then((AMap)=>{
map = new AMap.Map('container');
}).catch(e=>{
console.log(e);
})
FAQs
高德官网提供的地图JSAPI加载器,可以避免多种异步加载API的错误用法
The npm package @amap/amap-jsapi-loader receives a total of 33,758 weekly downloads. As such, @amap/amap-jsapi-loader popularity was classified as popular.
We found that @amap/amap-jsapi-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.