INNER CODE UNIT · TypeScript
isMasterJobRunMessage
andywer/threads.js · src/worker/index.ts:31
const isMasterJobRunMessage = (thing: any): thing is MasterJobRunMessage => thing && thing.type === MasterMessageType.run
/**
* There are issues with `is-observable` not recognizing zen-observable's instances.
* We are using `observable-fns`, but it's based on zen-observable, too.
*/
const isObservable = (thing: any): thing is Observable<any> => isSomeObservable(thing) || isZenObservable(thing)
function isZenObservable(thing: any): thing is Observable<any> {
return thing && typeof thing === "object" && typeof thing.subscribe === "function"
}
function deconstructTransfer(thing: any) {
return isTransferDescriptor(thing)
? { payload: thing.send, transferables: thing.transferables }
: { payload: thing, transferables: undefined }
}