penambahan web socket
This commit is contained in:
108
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.cjs
generated
vendored
Normal file
108
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
|
||||
const GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
|
||||
class QuansyncError extends Error {
|
||||
constructor(message = "Unexpected promise in sync context") {
|
||||
super(message);
|
||||
this.name = "QuansyncError";
|
||||
}
|
||||
}
|
||||
function isThenable(value) {
|
||||
return value && typeof value === "object" && typeof value.then === "function";
|
||||
}
|
||||
function isQuansyncGenerator(value) {
|
||||
return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
|
||||
}
|
||||
function fromObject(options) {
|
||||
const generator = function* (...args) {
|
||||
const isAsync = yield GET_IS_ASYNC;
|
||||
if (isAsync)
|
||||
return yield options.async.apply(this, args);
|
||||
return options.sync.apply(this, args);
|
||||
};
|
||||
function fn(...args) {
|
||||
const iter = generator.apply(this, args);
|
||||
iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
|
||||
iter.__quansync = true;
|
||||
return iter;
|
||||
}
|
||||
fn.sync = options.sync;
|
||||
fn.async = options.async;
|
||||
return fn;
|
||||
}
|
||||
function fromPromise(promise) {
|
||||
return fromObject({
|
||||
async: () => Promise.resolve(promise),
|
||||
sync: () => {
|
||||
if (isThenable(promise))
|
||||
throw new QuansyncError();
|
||||
return promise;
|
||||
}
|
||||
});
|
||||
}
|
||||
function unwrapYield(value, isAsync) {
|
||||
if (value === GET_IS_ASYNC)
|
||||
return isAsync;
|
||||
if (isQuansyncGenerator(value))
|
||||
return isAsync ? iterateAsync(value) : iterateSync(value);
|
||||
if (!isAsync && isThenable(value))
|
||||
throw new QuansyncError();
|
||||
return value;
|
||||
}
|
||||
const DEFAULT_ON_YIELD = (value) => value;
|
||||
function iterateSync(generator, onYield = DEFAULT_ON_YIELD) {
|
||||
let current = generator.next();
|
||||
while (!current.done) {
|
||||
try {
|
||||
current = generator.next(unwrapYield(onYield(current.value, false)));
|
||||
} catch (err) {
|
||||
current = generator.throw(err);
|
||||
}
|
||||
}
|
||||
return unwrapYield(current.value);
|
||||
}
|
||||
async function iterateAsync(generator, onYield = DEFAULT_ON_YIELD) {
|
||||
let current = generator.next();
|
||||
while (!current.done) {
|
||||
try {
|
||||
current = generator.next(await unwrapYield(onYield(current.value, true), true));
|
||||
} catch (err) {
|
||||
current = generator.throw(err);
|
||||
}
|
||||
}
|
||||
return current.value;
|
||||
}
|
||||
function fromGeneratorFn(generatorFn, options) {
|
||||
return fromObject({
|
||||
name: generatorFn.name,
|
||||
async(...args) {
|
||||
return iterateAsync(generatorFn.apply(this, args), options?.onYield);
|
||||
},
|
||||
sync(...args) {
|
||||
return iterateSync(generatorFn.apply(this, args), options?.onYield);
|
||||
}
|
||||
});
|
||||
}
|
||||
function quansync(input, options) {
|
||||
if (isThenable(input))
|
||||
return fromPromise(input);
|
||||
if (typeof input === "function")
|
||||
return fromGeneratorFn(input, options);
|
||||
else
|
||||
return fromObject(input);
|
||||
}
|
||||
function toGenerator(promise) {
|
||||
if (isQuansyncGenerator(promise))
|
||||
return promise;
|
||||
return fromPromise(promise)();
|
||||
}
|
||||
const getIsAsync = quansync({
|
||||
async: () => Promise.resolve(true),
|
||||
sync: () => false
|
||||
});
|
||||
|
||||
exports.GET_IS_ASYNC = GET_IS_ASYNC;
|
||||
exports.QuansyncError = QuansyncError;
|
||||
exports.getIsAsync = getIsAsync;
|
||||
exports.quansync = quansync;
|
||||
exports.toGenerator = toGenerator;
|
||||
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.cts
generated
vendored
Normal file
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions, QuansyncGenerator } from './types.cjs';
|
||||
export { QuansyncAwaitableGenerator, QuansyncInput } from './types.cjs';
|
||||
|
||||
declare const GET_IS_ASYNC: unique symbol;
|
||||
declare class QuansyncError extends Error {
|
||||
constructor(message?: string);
|
||||
}
|
||||
/**
|
||||
* Creates a new Quansync function, a "superposition" between async and sync.
|
||||
*/
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return>, options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
/**
|
||||
* Converts a promise to a Quansync generator.
|
||||
*/
|
||||
declare function toGenerator<T>(promise: Promise<T> | QuansyncGenerator<T> | T): QuansyncGenerator<T>;
|
||||
/**
|
||||
* @returns `true` if the current context is async, `false` otherwise.
|
||||
*/
|
||||
declare const getIsAsync: QuansyncFn<boolean, []>;
|
||||
|
||||
export { GET_IS_ASYNC, QuansyncError, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, getIsAsync, quansync, toGenerator };
|
||||
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.mts
generated
vendored
Normal file
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions, QuansyncGenerator } from './types.mjs';
|
||||
export { QuansyncAwaitableGenerator, QuansyncInput } from './types.mjs';
|
||||
|
||||
declare const GET_IS_ASYNC: unique symbol;
|
||||
declare class QuansyncError extends Error {
|
||||
constructor(message?: string);
|
||||
}
|
||||
/**
|
||||
* Creates a new Quansync function, a "superposition" between async and sync.
|
||||
*/
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return>, options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
/**
|
||||
* Converts a promise to a Quansync generator.
|
||||
*/
|
||||
declare function toGenerator<T>(promise: Promise<T> | QuansyncGenerator<T> | T): QuansyncGenerator<T>;
|
||||
/**
|
||||
* @returns `true` if the current context is async, `false` otherwise.
|
||||
*/
|
||||
declare const getIsAsync: QuansyncFn<boolean, []>;
|
||||
|
||||
export { GET_IS_ASYNC, QuansyncError, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, getIsAsync, quansync, toGenerator };
|
||||
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.ts
generated
vendored
Normal file
22
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions, QuansyncGenerator } from './types.js';
|
||||
export { QuansyncAwaitableGenerator, QuansyncInput } from './types.js';
|
||||
|
||||
declare const GET_IS_ASYNC: unique symbol;
|
||||
declare class QuansyncError extends Error {
|
||||
constructor(message?: string);
|
||||
}
|
||||
/**
|
||||
* Creates a new Quansync function, a "superposition" between async and sync.
|
||||
*/
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
declare function quansync<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return>, options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
/**
|
||||
* Converts a promise to a Quansync generator.
|
||||
*/
|
||||
declare function toGenerator<T>(promise: Promise<T> | QuansyncGenerator<T> | T): QuansyncGenerator<T>;
|
||||
/**
|
||||
* @returns `true` if the current context is async, `false` otherwise.
|
||||
*/
|
||||
declare const getIsAsync: QuansyncFn<boolean, []>;
|
||||
|
||||
export { GET_IS_ASYNC, QuansyncError, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, getIsAsync, quansync, toGenerator };
|
||||
102
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.mjs
generated
vendored
Normal file
102
examples/nuxt3-websocket-client/node_modules/quansync/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
const GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
|
||||
class QuansyncError extends Error {
|
||||
constructor(message = "Unexpected promise in sync context") {
|
||||
super(message);
|
||||
this.name = "QuansyncError";
|
||||
}
|
||||
}
|
||||
function isThenable(value) {
|
||||
return value && typeof value === "object" && typeof value.then === "function";
|
||||
}
|
||||
function isQuansyncGenerator(value) {
|
||||
return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
|
||||
}
|
||||
function fromObject(options) {
|
||||
const generator = function* (...args) {
|
||||
const isAsync = yield GET_IS_ASYNC;
|
||||
if (isAsync)
|
||||
return yield options.async.apply(this, args);
|
||||
return options.sync.apply(this, args);
|
||||
};
|
||||
function fn(...args) {
|
||||
const iter = generator.apply(this, args);
|
||||
iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
|
||||
iter.__quansync = true;
|
||||
return iter;
|
||||
}
|
||||
fn.sync = options.sync;
|
||||
fn.async = options.async;
|
||||
return fn;
|
||||
}
|
||||
function fromPromise(promise) {
|
||||
return fromObject({
|
||||
async: () => Promise.resolve(promise),
|
||||
sync: () => {
|
||||
if (isThenable(promise))
|
||||
throw new QuansyncError();
|
||||
return promise;
|
||||
}
|
||||
});
|
||||
}
|
||||
function unwrapYield(value, isAsync) {
|
||||
if (value === GET_IS_ASYNC)
|
||||
return isAsync;
|
||||
if (isQuansyncGenerator(value))
|
||||
return isAsync ? iterateAsync(value) : iterateSync(value);
|
||||
if (!isAsync && isThenable(value))
|
||||
throw new QuansyncError();
|
||||
return value;
|
||||
}
|
||||
const DEFAULT_ON_YIELD = (value) => value;
|
||||
function iterateSync(generator, onYield = DEFAULT_ON_YIELD) {
|
||||
let current = generator.next();
|
||||
while (!current.done) {
|
||||
try {
|
||||
current = generator.next(unwrapYield(onYield(current.value, false)));
|
||||
} catch (err) {
|
||||
current = generator.throw(err);
|
||||
}
|
||||
}
|
||||
return unwrapYield(current.value);
|
||||
}
|
||||
async function iterateAsync(generator, onYield = DEFAULT_ON_YIELD) {
|
||||
let current = generator.next();
|
||||
while (!current.done) {
|
||||
try {
|
||||
current = generator.next(await unwrapYield(onYield(current.value, true), true));
|
||||
} catch (err) {
|
||||
current = generator.throw(err);
|
||||
}
|
||||
}
|
||||
return current.value;
|
||||
}
|
||||
function fromGeneratorFn(generatorFn, options) {
|
||||
return fromObject({
|
||||
name: generatorFn.name,
|
||||
async(...args) {
|
||||
return iterateAsync(generatorFn.apply(this, args), options?.onYield);
|
||||
},
|
||||
sync(...args) {
|
||||
return iterateSync(generatorFn.apply(this, args), options?.onYield);
|
||||
}
|
||||
});
|
||||
}
|
||||
function quansync(input, options) {
|
||||
if (isThenable(input))
|
||||
return fromPromise(input);
|
||||
if (typeof input === "function")
|
||||
return fromGeneratorFn(input, options);
|
||||
else
|
||||
return fromObject(input);
|
||||
}
|
||||
function toGenerator(promise) {
|
||||
if (isQuansyncGenerator(promise))
|
||||
return promise;
|
||||
return fromPromise(promise)();
|
||||
}
|
||||
const getIsAsync = quansync({
|
||||
async: () => Promise.resolve(true),
|
||||
sync: () => false
|
||||
});
|
||||
|
||||
export { GET_IS_ASYNC, QuansyncError, getIsAsync, quansync, toGenerator };
|
||||
7
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.cjs
generated
vendored
Normal file
7
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.cjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const index = require('./index.cjs');
|
||||
|
||||
const quansync = index.quansync;
|
||||
|
||||
exports.quansync = quansync;
|
||||
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.cts
generated
vendored
Normal file
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.cts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions } from './types.cjs';
|
||||
export { QuansyncAwaitableGenerator, QuansyncGenerator, QuansyncInput } from './types.cjs';
|
||||
|
||||
/**
|
||||
* This function is equivalent to `quansync` from main entry
|
||||
* but accepts a fake argument type of async functions.
|
||||
*
|
||||
* This requires to be used with the macro transformer `unplugin-quansync`.
|
||||
* Do NOT use it directly.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
declare const quansync: {
|
||||
<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return> | ((...args: Args) => Promise<Return> | Return), options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
};
|
||||
|
||||
export { QuansyncFn, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, quansync };
|
||||
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.mts
generated
vendored
Normal file
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.mts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions } from './types.mjs';
|
||||
export { QuansyncAwaitableGenerator, QuansyncGenerator, QuansyncInput } from './types.mjs';
|
||||
|
||||
/**
|
||||
* This function is equivalent to `quansync` from main entry
|
||||
* but accepts a fake argument type of async functions.
|
||||
*
|
||||
* This requires to be used with the macro transformer `unplugin-quansync`.
|
||||
* Do NOT use it directly.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
declare const quansync: {
|
||||
<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return> | ((...args: Args) => Promise<Return> | Return), options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
};
|
||||
|
||||
export { QuansyncFn, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, quansync };
|
||||
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.ts
generated
vendored
Normal file
18
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { QuansyncInputObject, QuansyncFn, QuansyncGeneratorFn, QuansyncOptions } from './types.js';
|
||||
export { QuansyncAwaitableGenerator, QuansyncGenerator, QuansyncInput } from './types.js';
|
||||
|
||||
/**
|
||||
* This function is equivalent to `quansync` from main entry
|
||||
* but accepts a fake argument type of async functions.
|
||||
*
|
||||
* This requires to be used with the macro transformer `unplugin-quansync`.
|
||||
* Do NOT use it directly.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
declare const quansync: {
|
||||
<Return, Args extends any[] = []>(input: QuansyncInputObject<Return, Args>): QuansyncFn<Return, Args>;
|
||||
<Return, Args extends any[] = []>(input: QuansyncGeneratorFn<Return, Args> | Promise<Return> | ((...args: Args) => Promise<Return> | Return), options?: QuansyncOptions): QuansyncFn<Return, Args>;
|
||||
};
|
||||
|
||||
export { QuansyncFn, QuansyncGeneratorFn, QuansyncInputObject, QuansyncOptions, quansync };
|
||||
5
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.mjs
generated
vendored
Normal file
5
examples/nuxt3-websocket-client/node_modules/quansync/dist/macro.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { quansync as quansync$1 } from './index.mjs';
|
||||
|
||||
const quansync = quansync$1;
|
||||
|
||||
export { quansync };
|
||||
2
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.cjs
generated
vendored
Normal file
2
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.cjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
|
||||
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.cts
generated
vendored
Normal file
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.cts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
interface QuansyncOptions {
|
||||
onYield?: (value: any, isAsync: boolean) => any;
|
||||
}
|
||||
interface QuansyncInputObject<Return, Args extends any[]> extends QuansyncOptions {
|
||||
name?: string;
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
}
|
||||
type QuansyncGeneratorFn<Return, Args extends any[]> = ((...args: Args) => QuansyncGenerator<Return>);
|
||||
type QuansyncInput<Return, Args extends any[]> = QuansyncInputObject<Return, Args> | QuansyncGeneratorFn<Return, Args>;
|
||||
type QuansyncGenerator<Return = any, Yield = unknown> = Generator<Yield, Return, Awaited<Yield>> & {
|
||||
__quansync?: true;
|
||||
};
|
||||
type QuansyncAwaitableGenerator<Return = any, Yield = unknown> = QuansyncGenerator<Return, Yield> & PromiseLike<Return>;
|
||||
/**
|
||||
* "Superposition" function that can be consumed in both sync and async contexts.
|
||||
*/
|
||||
type QuansyncFn<Return = any, Args extends any[] = []> = ((...args: Args) => QuansyncAwaitableGenerator<Return>) & {
|
||||
/**
|
||||
* **Warning**: The `async` and `sync` methods will be lost after invoked.
|
||||
*/
|
||||
bind: <T, A extends any[], B extends any[]>(this: (this: T, ...args: [...A, ...B]) => QuansyncAwaitableGenerator<Return>, thisArg: T, ...args: A) => ((...args: B) => QuansyncAwaitableGenerator<Return>);
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
};
|
||||
|
||||
export type { QuansyncAwaitableGenerator, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInput, QuansyncInputObject, QuansyncOptions };
|
||||
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.mts
generated
vendored
Normal file
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.mts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
interface QuansyncOptions {
|
||||
onYield?: (value: any, isAsync: boolean) => any;
|
||||
}
|
||||
interface QuansyncInputObject<Return, Args extends any[]> extends QuansyncOptions {
|
||||
name?: string;
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
}
|
||||
type QuansyncGeneratorFn<Return, Args extends any[]> = ((...args: Args) => QuansyncGenerator<Return>);
|
||||
type QuansyncInput<Return, Args extends any[]> = QuansyncInputObject<Return, Args> | QuansyncGeneratorFn<Return, Args>;
|
||||
type QuansyncGenerator<Return = any, Yield = unknown> = Generator<Yield, Return, Awaited<Yield>> & {
|
||||
__quansync?: true;
|
||||
};
|
||||
type QuansyncAwaitableGenerator<Return = any, Yield = unknown> = QuansyncGenerator<Return, Yield> & PromiseLike<Return>;
|
||||
/**
|
||||
* "Superposition" function that can be consumed in both sync and async contexts.
|
||||
*/
|
||||
type QuansyncFn<Return = any, Args extends any[] = []> = ((...args: Args) => QuansyncAwaitableGenerator<Return>) & {
|
||||
/**
|
||||
* **Warning**: The `async` and `sync` methods will be lost after invoked.
|
||||
*/
|
||||
bind: <T, A extends any[], B extends any[]>(this: (this: T, ...args: [...A, ...B]) => QuansyncAwaitableGenerator<Return>, thisArg: T, ...args: A) => ((...args: B) => QuansyncAwaitableGenerator<Return>);
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
};
|
||||
|
||||
export type { QuansyncAwaitableGenerator, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInput, QuansyncInputObject, QuansyncOptions };
|
||||
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.ts
generated
vendored
Normal file
27
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
interface QuansyncOptions {
|
||||
onYield?: (value: any, isAsync: boolean) => any;
|
||||
}
|
||||
interface QuansyncInputObject<Return, Args extends any[]> extends QuansyncOptions {
|
||||
name?: string;
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
}
|
||||
type QuansyncGeneratorFn<Return, Args extends any[]> = ((...args: Args) => QuansyncGenerator<Return>);
|
||||
type QuansyncInput<Return, Args extends any[]> = QuansyncInputObject<Return, Args> | QuansyncGeneratorFn<Return, Args>;
|
||||
type QuansyncGenerator<Return = any, Yield = unknown> = Generator<Yield, Return, Awaited<Yield>> & {
|
||||
__quansync?: true;
|
||||
};
|
||||
type QuansyncAwaitableGenerator<Return = any, Yield = unknown> = QuansyncGenerator<Return, Yield> & PromiseLike<Return>;
|
||||
/**
|
||||
* "Superposition" function that can be consumed in both sync and async contexts.
|
||||
*/
|
||||
type QuansyncFn<Return = any, Args extends any[] = []> = ((...args: Args) => QuansyncAwaitableGenerator<Return>) & {
|
||||
/**
|
||||
* **Warning**: The `async` and `sync` methods will be lost after invoked.
|
||||
*/
|
||||
bind: <T, A extends any[], B extends any[]>(this: (this: T, ...args: [...A, ...B]) => QuansyncAwaitableGenerator<Return>, thisArg: T, ...args: A) => ((...args: B) => QuansyncAwaitableGenerator<Return>);
|
||||
sync: (...args: Args) => Return;
|
||||
async: (...args: Args) => Promise<Return>;
|
||||
};
|
||||
|
||||
export type { QuansyncAwaitableGenerator, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInput, QuansyncInputObject, QuansyncOptions };
|
||||
1
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.mjs
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/quansync/dist/types.mjs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user