mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-04-03 07:51:41 +00:00
- Move marine-related part into FJS repo (fixes DXJ-184) - Move towards component-oriented architecture (fixes DXJ-183) - Different JS Client distros for node.js and web (fixes DXJ-185) - Update libp2p to 0.42.2 (fixes DXJ-26) - Add JS Client API (fixes DXJ-196, fixes DXJ-177, fixes DXJ-60) - Add Smoke test for JS Client web (fixes DXJ-253) --------- Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
19 lines
977 B
TypeScript
19 lines
977 B
TypeScript
import { FluencePeer } from '@fluencelabs/js-peer/dist/js-peer/FluencePeer.js';
|
|
import { MarineBasedAvmRunner } from '@fluencelabs/js-peer/dist/js-peer/avm.js';
|
|
import { MarineBackgroundRunner } from '@fluencelabs/js-peer/dist/marine/worker';
|
|
import { checkConnection, marineLogFunction } from '@fluencelabs/js-peer/dist/js-peer/utils.js';
|
|
import { InlinedWorkerLoader, InlinedWasmLoader } from '@fluencelabs/js-peer/dist/marine/deps-loader/common.js';
|
|
|
|
export const makeDefaultPeer = () => {
|
|
const workerLoader = new InlinedWorkerLoader('___worker___');
|
|
const controlModuleLoader = new InlinedWasmLoader('___marine___');
|
|
const avmModuleLoader = new InlinedWasmLoader('___avm___');
|
|
|
|
const marine = new MarineBackgroundRunner(workerLoader, controlModuleLoader, marineLogFunction);
|
|
const avm = new MarineBasedAvmRunner(marine, avmModuleLoader, undefined);
|
|
return new FluencePeer(marine, avm);
|
|
};
|
|
|
|
// @ts-ignore
|
|
globalThis.defaultPeer = makeDefaultPeer();
|