mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 09:33:58 -05:00
537673cdf6
IDE scope store and emitter with fixed PDF URLs GitOrigin-RevId: 9d33bad8a006bb55714878332f78932538dd8921
22 lines
674 B
TypeScript
22 lines
674 B
TypeScript
import {
|
|
ScopeEventEmitter,
|
|
ScopeEventName,
|
|
} from '../../../../../types/ide/scope-event-emitter'
|
|
import { Scope } from '../../../../../types/angular/scope'
|
|
|
|
export class AngularScopeEventEmitter implements ScopeEventEmitter {
|
|
// eslint-disable-next-line no-useless-constructor
|
|
constructor(readonly $scope: Scope) {}
|
|
|
|
emit(eventName: ScopeEventName, broadcast: boolean, ...detail: unknown[]) {
|
|
if (broadcast) {
|
|
this.$scope.$broadcast(eventName, ...detail)
|
|
} else {
|
|
this.$scope.$emit(eventName, ...detail)
|
|
}
|
|
}
|
|
|
|
on(eventName: ScopeEventName, listener: (...args: unknown[]) => void) {
|
|
return this.$scope.$on(eventName, listener)
|
|
}
|
|
}
|