0

There are two files

file 1

import { getSingleRunningPromiseFunction } from "./main"

const getSingleRunningPromise = getSingleRunningPromiseFunction.bind({
    singlePromise: undefined,
    promise: undefined,
    running: false,
});

getSingleRunningPromise()

file 2

import { getSingleRunningPromiseFunction } from "./main"

const getSingleRunningPromise = getSingleRunningPromiseFunction.bind({
    singlePromise: undefined,
    promise: undefined,
    running: false,
});

getSingleRunningPromise()

I'd like to extract bind logic, but this variant will share the binded between all consumers

export const getSingleRunningPromise = getSingleRunningPromiseFunction.bind({
    singlePromise: undefined,
    promise: undefined,
    running: false,
});

Is it possible to extract bind and don't create a function? E.g. do import { getSingleRunningPromise } from "./main" but for each consumer provide unique this context?

1 Answers

MA==
zX۬yyw(uhr鮖ةb}z{\׭+?r^nz-)ʋhH+kyyi_w-zԢ ^Fx櫂޶Rx%y)>&Džw-jYlx%x+w^~)
&Ǯןw
xj[
j,{k