Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
angular-qq-maps
Advanced tools
Readme
QQ Maps Components for Angular
npm install angular-qq-maps --save
把 AqmModule
模块导入到你项目中。
import { AqmModule } from 'angular-qq-maps';
@NgModule({
imports: [
BrowserModule,
AqmModule.forRoot({
apiKey: '' // app key为必选项
})
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
地图组件
<aqm-map #map [options]="options" (ready)="onReady($event)" style="height: 300px;"></aqm-map>
街景组件
<aqm-panorama #map [options]="options" (ready)="onReady($event)" style="height: 500px;"></aqm-panorama>
默认自动异步加载 js 类库,所以只需要在 NgModule 提供 api key 就可以立即使用了。 options
等同腾讯地图 new qq.maps.Map(mapContainer, options)
。
我精力有限,而如果真要以Angular的角度去开发腾讯地图工作量非常大,而且官网也并无提供一份良好的Typescript接口定义,所以放弃过度性封装。正因为如此,所以您在注册事件的时候还是要认真一点。
腾讯地图除绝大部分所需要的事件都是依赖于 qq.maps.event
对象的创建和删除动作,Angular是一种单页开发模式,对资源的创建与销毁是非常重要的。如果你在开发腾讯地图的时候突然发现被污染了,那说明你的并没有正确的销毁。
因此,我建议,当你需要注册一个地图的 click
事件时:
//添加监听事件
qq.maps.event.addListener(this.map, 'click', (event: any) => {
// doing
this.zone.run(() => {
// 对于需要Angular监听的变量而放在 zone 里面,可以确保页面渲染。
this.status = `click ${+new Date}`;
});
});
与之相对应,一定要在 ngOnDestroy
对事件的销毁:
ngOnDestroy(): void {
['click'].forEach(eventName => {
qq.maps.event.clearListeners(this.map, eventName);
});
}
当然,这里还有一些关于覆盖物相关里面涉及的事件,也一并做相应的销毁处理。
很抱歉,如果你在使用 angular-qq-maps
的时候请认真阅读。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
gl | boolean | false | 表示使用 JavaScript API GL 版本 |
apiKey | string | - | APP KEY 必填项 |
apiHostAndPath | string | map.qq.com/api/js | - |
apiCallback | string | angularQQMapsLoader | API异步加载回调函数名 |
apiVersion | string | 2.exp | API版本号 |
apiLibraries | string[] | - | 附加库 |
apiProtocol | string | auto | API 请求协议 |
mapOptions | Object | - | 默认地图配置项,等同于MapOptions 对象规范,当指定 gl: true 表示Gl版本的MapOptions 对象规范 |
panoramaOptions | Object | - | 默认街景配置项,等同于PanoramaOptions 对象规范 |
Please follow this guidelines when reporting bugs and feature requests:
Thanks for understanding!
The MIT License (see the LICENSE file for the full text)
FAQs
Angular QQ Maps Components
We found that angular-qq-maps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.