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
| import debounce from 'lodash/debounce' | |
| import { RefObject, useEffect } from 'react' | |
| export const useWidthObserver = <T extends HTMLElement>( | |
| refObject: RefObject<T>, | |
| setWidth: (width: number) => void | |
| ) => { | |
| useEffect(() => { | |
| function resizeListener() { | |
| if (refObject.current) { |
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
| import { Client, ServiceError, Metadata, CallOptions, ClientUnaryCall } from '@grpc/grpc-js'; | |
| import { Message } from 'google-protobuf'; | |
| type OriginalCall<T, U> = (request: T, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError, res: U) => void) => ClientUnaryCall; | |
| type PromisifiedCall<T, U> = ((request: T, metadata?: Metadata, options?: Partial<CallOptions>) => Promise<U>); | |
| export type Promisified<C> = { $: C; } & { | |
| [prop in Exclude<keyof C, keyof Client>]: (C[prop] extends OriginalCall<infer T, infer U> ? PromisifiedCall<T, U> : never); | |
| } |
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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "runtime" | |
| "testing" | |
| ) | |
| func TestMain(m *testing.M) { |
OlderNewer