import { AsyncCall , AsyncCallOptions , AsyncGeneratorCall } from 'async-call-rpc/full' ; import { WorkerChannel } from 'async-call-rpc/utils/web/worker' ; import { serializer } from '@masknet/shared-base' ; import { OnDemandWorker } from '../../../utils-pure' ; import type { _AsyncVersionOf , _AsyncGeneratorVersionOf } from 'async-call-rpc/full' ; export let GunWorker ; if ( process . env . architecture ) { GunWorker = new OnDemandWorker ( new URL ( './worker.ts' , import . meta . url ) , { name : 'Gun' } ) ; } const options = { channel : new WorkerChannel ( GunWorker ) , serializer , } ; export const GunAPI = AsyncCall ( { } , options ) ; export const GunAPISubscribe = AsyncGeneratorCall ( { } , options ) ;