This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rehooktive(Hook.OnChanges) | |
private readonly onChanges$: Observable<SimpleChanges>; | |
constructor() { | |
this.onChanges$ | |
.pipe( | |
pluck('events'), | |
filter<SimpleChange>(Boolean), | |
switchMap(events => this.registerEvents(events.currentValue)) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rehooktive(Hook.OnChanges) | |
private readonly onChanges$: Observable<SimpleChanges>; | |
ngOnChanges({ events }: SimpleChanges) { | |
if (events) { | |
this.registerEvents(this.events) | |
.pipe(takeUntil(this.onChanges$)) | |
.subscribe(event => this.logEvent(event, this.properties)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly onChanges$$ = new Subject(); | |
private readonly onChanges$ = this.onChanges$$.pipe(); | |
ngOnChanges({ events }: SimpleChanges) { | |
this.onChanges$$.next(); | |
if (events) { | |
this.registerEvents(this.events) | |
.pipe( | |
takeUntil(this.onChanges$), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<toolbar (editChange)="isEditMode = $event"></toolbar> | |
<text-editor analytics | |
[edit]="isEditMode" | |
[events]="isEditMode ? ['contextmenu', 'focus'] : ['focus']"> | |
</text-editor> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private registeredEventsSubscription: Subscription; | |
ngOnChanges({ events }: SimpleChanges) { | |
if (events) { | |
this.unsubscribeRegisteredEvents(); | |
this.registeredEventsSubscription = this.registerEvents(this.events) | |
.pipe(untilDestroyed(this)) | |
.subscribe(event => this.logEvent(event, this.properties)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Supported events for analytics. | |
*/ | |
export type AnalyticsEvent = 'click' | 'focus' | 'blur'; | |
/** | |
* Directive that used to log client events to the analytics provider by using {@link AnalyticsService}. | |
*/ | |
@Directive({ selector: '[analytics]' }) | |
export class AnalyticsDirective implements OnChanges { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: "[mouse]", | |
exportAs: "mouse" | |
}) | |
export class MouseComponent { | |
private _state = { x: 0, y: 0 }; | |
get state() { | |
return this._state; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st = status | |
s = switch | |
cp = cherry-pick | |
cpc = cherry-pick --continue | |
cps = cherry-pick --skip | |
cpa = cherry-pick --abort | |
rbc = rebase --continue | |
rbs = rebase --skip | |
rba = rebase --abort | |
bm = "!f() { git branch -m "$1"; }; f" |