Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export YaReadyEvent and YaEvent #93

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
createPlacemarkConstructorSpy,
createPlacemarkSpy,
} from '../../testing/fake-ymaps-utils';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { Observable, Subscription } from 'rxjs';
import { YaGeoObjectDirective } from '../ya-geoobject/ya-geoobject.directive';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaPlacemarkDirective } from '../ya-placemark/ya-placemark.directive';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* The `ya-clusterer` component wraps `ymaps.Clusterer` class from the Yandex Maps API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createRoutePanelSpy,
} from '../../testing/fake-ymaps-utils';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: '<ya-control [type]="type" [parameters]="parameters"></ya-control>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Output,
} from '@angular/core';
import { Subscription } from 'rxjs';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../typings/ya-ready-event';

export type YaControlType =
| 'Button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createGeoObjectSpy,
createMapSpy,
} from '../../testing/fake-ymaps-utils';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
SimpleChanges,
} from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* The `ya-geoobject` component wraps `ymaps.GeoObject` class from the Yandex Maps API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Component, ViewChild } from '@angular/core';

import * as GenerateRandomIdModule from '../../utils/generate-random-id';
import { YaMapComponent } from './ya-map.component';
import { YaReadyEvent } from '../../utils/event-manager';
import {
createMapConstructorSpy,
createMapSpy,
createReadySpy,
} from '../../testing/fake-ymaps-utils';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import {
} from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { generateRandomId } from '../../utils/generate-random-id';
import { YaApiLoaderService } from '../../services/ya-api-loader/ya-api-loader.service';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* The `ya-map` component wraps `ymaps.Map` class from the Yandex Maps API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createMultirouteConstructorSpy,
createMultirouteSpy,
} from '../../testing/fake-ymaps-utils';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
SimpleChanges,
} from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createPlayerSpy,
} from '../../testing/fake-ymaps-utils';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {
} from '@angular/core';
import { from, Observable, Subscription } from 'rxjs';
import { filter, map, switchMap } from 'rxjs/operators';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* The `ya-panorama` component wraps `ymaps.panorama.Player` class from the Yandex Maps API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createPlacemarkSpy,
} from '../../testing/fake-ymaps-utils';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { YaReadyEvent } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
} from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { YaMapComponent } from '../ya-map/ya-map.component';
import { EventManager, YaEvent, YaReadyEvent } from '../../utils/event-manager';
import { EventManager } from '../../utils/event-manager';
import { YaReadyEvent } from '../../typings/ya-ready-event';
import { YaEvent } from '../../typings/ya-event';

/**
* The `ya-placemark` directive wraps `ymaps.Placemark` class from the Yandex Maps API.
Expand Down
15 changes: 15 additions & 0 deletions projects/angular8-yandex-maps/src/lib/typings/ya-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface YaEvent<T = any> {
/**
* Instance of target
*/
target: T;
/**
* API global object
*/
ymaps: typeof ymaps;
/**
* Provides methods for accessing the originalObject object's fields and methods, with the possibility for redefining them.
* {@link https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/Event.html/}
*/
event: ymaps.Event<any, T>;
}
10 changes: 10 additions & 0 deletions projects/angular8-yandex-maps/src/lib/typings/ya-ready-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface YaReadyEvent<T = any> {
/**
* Instance of target
*/
target: T;
/**
* API global object
*/
ymaps: typeof ymaps;
}
19 changes: 1 addition & 18 deletions projects/angular8-yandex-maps/src/lib/utils/event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,7 @@
import { NgZone } from '@angular/core';
import { BehaviorSubject, Observable, Subscriber } from 'rxjs';
import { switchMap } from 'rxjs/operators';

export interface YaEvent<T = any> {
/**
* Instance of target
*/
target: T;
/**
* API global object
*/
ymaps: typeof ymaps;
/**
* Provides methods for accessing the originalObject object's fields and methods, with the possibility for redefining them.
* {@link https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/Event.html/}
*/
event: ymaps.Event<any, T>;
}

export type YaReadyEvent<T = any> = Omit<YaEvent<T>, 'event'>;
import { YaEvent } from '../typings/ya-event';

/**
* @internal
Expand Down
4 changes: 4 additions & 0 deletions projects/angular8-yandex-maps/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export * from './lib/angular-yandex-maps.module';
export * from './lib/services/ya-api-loader/ya-api-loader.service';
export * from './lib/services/ya-geocoder/ya-geocoder.service';

// Interfaces
export * from './lib/typings/ya-event';
export * from './lib/typings/ya-ready-event';

// Components
export * from './lib/components/ya-clusterer/ya-clusterer.component';
export * from './lib/components/ya-control/ya-control.directive';
Expand Down