Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 6a30bd8

Browse files
committed
first version
0 parents  commit 6a30bd8

28 files changed

+3641
-0
lines changed

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Node
2+
node_modules/*
3+
npm-debug.log
4+
5+
# TypeScript
6+
*.js
7+
!rollup.config.js
8+
*.map
9+
*.d.ts
10+
# JetBrains
11+
.idea
12+
.project
13+
.settings
14+
.idea/*
15+
*.iml
16+
17+
# Windows
18+
Thumbs.db
19+
Desktop.ini
20+
21+
# Mac
22+
.DS_Store
23+
**/.DS_Store

.npmignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Node
2+
node_modules/*
3+
npm-debug.log
4+
5+
# DO NOT IGNORE TYPESCRIPT FILES FOR NPM
6+
# TypeScript
7+
# *.js
8+
# *.map
9+
# *.d.ts
10+
11+
# JetBrains
12+
.idea
13+
.project
14+
.settings
15+
.idea/*
16+
*.iml
17+
18+
# Windows
19+
Thumbs.db
20+
Desktop.ini
21+
22+
# Mac
23+
.DS_Store
24+
**/.DS_Store

.travis.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- 9.5.0
5+
install:
6+
- npm install
7+
script:
8+
- npm run build
9+
deploy:
10+
provider: npm
11+
email: milan.jaric@gmail.com
12+
api_key: gh9wiJBT6dULIMbbkeVJUn0gdCWrSINqOV+DDuLIuo8uFWL2ZC+Gim81ziZ2JZziiBy9szVbQ0ztCEh+3UWXYWdUAKTSW8ZB0Yf9vRxptEtYOUaqZeNcJu+6VoY4V9/8cRQ++iN4/Ip2vruyrHqv2Knt5oO0taJVxoz+5Rnrdndf8JmvE1xQTqn/yce4McjkhLCraNE8Bkds9UPMFCPZph+L5dUIgwcOY6Lvjbw4b1+gumD78s4SEpzPzMBQw0fBjvLLtG5f8C7Y3uIPCmAoWQCi6rO9mzy4OJ5ToYDN+dB7WH2GXcPYYdWRkw1abn473a17H8hM3juYxqdWLOrH9bOWWzKk5P8TtEfB0jATc7Y5M2Cx65iCVGB3V9JbZa3JGVf3zfr/6+Ez4wwdilq/uocNlyimjqZA+pOnCmh4PzpMSqeORXlamTsrEvT4irfCpOUVROKZCDWqvnmaVWnnZBcdUZ0TwUlY/dzZYIF/j2hkRCQTSqVT6suruX3LDNpYicrhWwsIqzuTgFN7BY51pdiRZHwigoXvNWee2gf7BpC4YgEmPDbhcf5Q2BYmXYOVlphSrT5exXox+v1bpwWrfvJN1pyAOKmCWmm5GdxNxeRD02u1+dAoviaZAJiS2BNBwALA7Z7rGBUsoXRMq0ID/pS8PQ5iWsvoBZEZRGAC8K4=
13+
on:
14+
tags: true
15+
repo: mjaric/ng-here-maps

index.ts

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import { LoaderOptions } from './src/loaders/loader-options.interface';
2+
import {
3+
LazyMapsApiLoader
4+
} from './src/loaders/lazy-maps-api-loader';
5+
import { APP_INITIALIZER, NgModule, ModuleWithProviders } from '@angular/core';
6+
import { MapsManager } from './src/services/maps-manager';
7+
import {BaseMapsApiLoader, LAZY_LOADER_OPTIONS} from './src/loaders/base-maps-api-loader';
8+
import { NoopMapsApiLoader } from './src/loaders/noop-maps-api-loader';
9+
import { MapComponent } from './src/directives/map';
10+
import { MapDirectionsDirective } from './src/directives/map-directions';
11+
import { MapMakerDirective } from './src/directives/map-marker';
12+
import { MapPolylineDirective } from './src/directives/map-polyline';
13+
export { LoaderOptions } from './src/loaders/loader-options.interface';
14+
15+
export {
16+
BaseMapComponent,
17+
MapComponent,
18+
MapDirectionsDirective,
19+
MapMakerDirective,
20+
MapPolylineDirective,
21+
IOptionalSetMapMethod
22+
} from './src/directives';
23+
export {
24+
BaseMapsApiLoader,
25+
LAZY_LOADER_OPTIONS,
26+
LazyMapsApiLoader,
27+
MapsManager,
28+
NoopMapsApiLoader,
29+
Animation,
30+
IAnimation,
31+
ZoomLevel,
32+
IZoomLevel,
33+
LatLng,
34+
GeoPoint,
35+
MarkerOptions,
36+
PolylineOptions
37+
} from './src/services';
38+
39+
/**
40+
* Factory function which builds handler for application initialization
41+
* @param loader instance of loader, should be passed as dependency
42+
* @returns {()=>Promise<any>} function is executed by angular application initializer
43+
* @constructor
44+
*/
45+
export function MapsApiLoaderFactory(loader: LazyMapsApiLoader) {
46+
return goLoad;
47+
48+
function goLoad(): Promise<any> {
49+
return loader.load();
50+
}
51+
}
52+
53+
@NgModule({
54+
declarations: [
55+
MapComponent,
56+
MapDirectionsDirective,
57+
MapMakerDirective,
58+
MapPolylineDirective
59+
],
60+
exports: [
61+
MapComponent,
62+
MapDirectionsDirective,
63+
MapMakerDirective,
64+
MapPolylineDirective
65+
]
66+
})
67+
export class HereMapsModule {
68+
/**
69+
* Used to register in top level or shared module in your application. Loader Options are mandatory.
70+
* {@expample
71+
* import {NgModule} from '@angular/core';
72+
*
73+
* @NgModule({
74+
* declarations: [...],
75+
* imports: [
76+
* ...
77+
* HereMapsModule.forRoot(<LoaderOptions>{
78+
* apiKey: "your heremaps API key
79+
* libraries: ["places", "geometry"]
80+
* }),
81+
* ...
82+
* ],
83+
* // optional, you can import module like below if your module depends only on component and directives
84+
* exports: [
85+
* HereMapsModule
86+
* ]
87+
* })
88+
* export class MySharedModule { }
89+
* }
90+
*
91+
* @param loaderOptions
92+
* @returns {ModuleWithProviders}
93+
*/
94+
static forRoot(loaderOptions: LoaderOptions): ModuleWithProviders {
95+
return {
96+
ngModule: HereMapsModule,
97+
providers: [
98+
{
99+
provide: LAZY_LOADER_OPTIONS,
100+
useValue: loaderOptions
101+
},
102+
LazyMapsApiLoader,
103+
{
104+
provide: APP_INITIALIZER,
105+
useFactory: MapsApiLoaderFactory,
106+
deps: [LazyMapsApiLoader],
107+
multi: true
108+
},
109+
{ provide: MapsManager, useClass: MapsManager }
110+
]
111+
};
112+
}
113+
}

0 commit comments

Comments
 (0)