1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00
Files
joplin/packages/lib/utils/ipc/utils/separateCallbacksFromSerializableArray.ts
2024-03-11 15:02:15 +00:00

23 lines
907 B
TypeScript

import { CallbackIds, SerializableData, SerializableDataAndCallbacks, TransferableCallback } from '../types';
import separateCallbacksFromSerializable from './separateCallbacksFromSerializable';
interface SeparatedCallbacksAndSerializableArrays {
serializableData: SerializableData[];
callbacks: CallbackIds[];
idToCallbacks: Record<string, TransferableCallback>;
}
const separateCallbacksFromSerializableArray = (args: SerializableDataAndCallbacks[]): SeparatedCallbacksAndSerializableArrays => {
const separatedArgs = separateCallbacksFromSerializable(args);
return {
idToCallbacks: separatedArgs.idToCallbacks,
// Because separateCallbacksFromSerializable is processing an array, it returns arrays.
callbacks: separatedArgs.callbacks as CallbackIds[],
serializableData: separatedArgs.serializableData as SerializableData[],
};
};
export default separateCallbacksFromSerializableArray;