mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Extract named types to help refactoring in next commit
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> Co-authored-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
2d8b4fcd78
commit
aeac31be99
@ -5,6 +5,9 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import loggerInjectable from "./logger.injectable";
|
import loggerInjectable from "./logger.injectable";
|
||||||
|
|
||||||
|
|
||||||
|
export type LogError = (message: string, ...data: any) => void;
|
||||||
|
|
||||||
const logErrorInjectable = getInjectable({
|
const logErrorInjectable = getInjectable({
|
||||||
id: "log-error",
|
id: "log-error",
|
||||||
instantiate: (di) => di.inject(loggerInjectable).error,
|
instantiate: (di) => di.inject(loggerInjectable).error,
|
||||||
|
|||||||
@ -6,13 +6,21 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import emitEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
|
import emitEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
|
||||||
import { observable, toJS } from "mobx";
|
import { observable, toJS } from "mobx";
|
||||||
|
|
||||||
|
export type EmitTelemetry = ({
|
||||||
|
action,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
action: string;
|
||||||
|
params?: object;
|
||||||
|
}) => void;
|
||||||
|
|
||||||
const emitTelemetryInjectable = getInjectable({
|
const emitTelemetryInjectable = getInjectable({
|
||||||
id: "emit-telemetry",
|
id: "emit-telemetry",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di): EmitTelemetry => {
|
||||||
const emitEvent = di.inject(emitEventInjectable);
|
const emitEvent = di.inject(emitEventInjectable);
|
||||||
|
|
||||||
return ({ action, params }: { action: string; params?: object }) => {
|
return ({ action, params }) => {
|
||||||
emitEvent({
|
emitEvent({
|
||||||
destination: "auto-capture",
|
destination: "auto-capture",
|
||||||
action: "telemetry-from-business-action",
|
action: "telemetry-from-business-action",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user