vue-identify-network
Version:
Identify the network your users are using!
55 lines (54 loc) • 2.15 kB
TypeScript
export type NetworkType = null | 'Unknown' | '2g' | '3g' | '4g' | 'wifi';
export type Evented = {
currentTarget: {
effectiveType: NetworkType;
downlink: number;
};
};
declare global {
interface Navigator {
connection: {
onchange: null | ((e: Evented) => void);
addEventListener(type: 'change', listener: (e: Evented) => void): void;
removeEventListener(type: 'change', listener: (e: Evented) => void): void;
effectiveType: NetworkType;
rtt: number;
downlink: number;
saveData: boolean;
};
}
}
type __VLS_ModelProps = {
'unknownClass'?: string | null;
'slowClass'?: string | null;
'fastClass'?: string | null;
};
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
type __VLS_Slots = {} & {
unknown?: (props: typeof __VLS_1) => any;
} & {
slow?: (props: typeof __VLS_3) => any;
} & {
fast?: (props: typeof __VLS_5) => any;
};
declare const __VLS_base: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"network-type": (e: NetworkType) => any;
"network-speed": (e: number | "Unknown") => any;
"update:unknownClass": (value: string | null) => any;
"update:slowClass": (value: string | null) => any;
"update:fastClass": (value: string | null) => any;
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
"onNetwork-type"?: ((e: NetworkType) => any) | undefined;
"onNetwork-speed"?: ((e: number | "Unknown") => any) | undefined;
"onUpdate:unknownClass"?: ((value: string | null) => any) | undefined;
"onUpdate:slowClass"?: ((value: string | null) => any) | undefined;
"onUpdate:fastClass"?: ((value: string | null) => any) | undefined;
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
export default _default;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};