new lines, renames, comments

This commit is contained in:
DieMyst
2021-04-15 12:45:18 +03:00
parent f14506a7a0
commit b234f4e689
10 changed files with 18 additions and 14 deletions

View File

@ -6,9 +6,12 @@ data NodeId:
peerId: PeerId peerId: PeerId
name: string name: string
service SomeSrv("somesrv"): -- define service `NodeIdGetter` that will be callable on local client via `somesrv` service id
service NodeIdGetter("somesrv"):
get: -> NodeId get: -> NodeId
func dataAliasFunc() -> PeerId: -- showcases a function that gets data structure from a local service,
res <- SomeSrv.get() -- and then retrieves aliased data type from that structure
func getAliasedData() -> PeerId:
res <- NodeIdGetter.get()
<- res.peerId <- res.peerId

View File

@ -5,4 +5,4 @@ export async function callArrowCall(client: FluenceClient) {
await passFunctionAsArg(client, client.relayPeerId!, (a: string) => { await passFunctionAsArg(client, client.relayPeerId!, (a: string) => {
return "Hello, " + a + "!" return "Hello, " + a + "!"
}) })
} }

View File

@ -3,4 +3,4 @@ import {doStuff} from "./compiled/complex";
export async function complexCall(client: FluenceClient) { export async function complexCall(client: FluenceClient) {
await doStuff(client, client.relayPeerId!) await doStuff(client, client.relayPeerId!)
} }

View File

@ -1,5 +1,5 @@
import {FluenceClient, registerServiceFunction} from "@fluencelabs/fluence"; import {FluenceClient, registerServiceFunction} from "@fluencelabs/fluence";
import {dataAliasFunc} from "./compiled/dataAlias"; import {getAliasedData} from "./compiled/dataAlias";
export async function dataAliasCall(client: FluenceClient) { export async function dataAliasCall(client: FluenceClient) {
registerServiceFunction(client, "somesrv", "get", (args: any[], _) => { registerServiceFunction(client, "somesrv", "get", (args: any[], _) => {
@ -9,6 +9,6 @@ export async function dataAliasCall(client: FluenceClient) {
} }
}) })
const peerId = await dataAliasFunc(client) const peerId = await getAliasedData(client)
console.log("PeerId: ", peerId); console.log("PeerId: ", peerId);
} }

View File

@ -6,4 +6,5 @@
await iterateAndPrintParallel(client, [client.relayPeerId!], (c) => { await iterateAndPrintParallel(client, [client.relayPeerId!], (c) => {
console.log("iterateAndPrintParallel. external addresses: " + c.external_addresses) console.log("iterateAndPrintParallel. external addresses: " + c.external_addresses)
}) })
} }

View File

@ -8,4 +8,4 @@ export async function funcCall(client: FluenceClient) {
const res = await testFunc(client); const res = await testFunc(client);
console.log("Message: ", res); console.log("Message: ", res);
} }

View File

@ -9,4 +9,4 @@ export async function helloWorldCall(client: FluenceClient) {
const hello = await helloWorld(client, "NAME"); const hello = await helloWorld(client, "NAME");
console.log("Message: ", hello); console.log("Message: ", hello);
} }

View File

@ -7,4 +7,4 @@ export async function ifCall(client: FluenceClient) {
await ifElseNumCall(client, 1) await ifElseNumCall(client, 1)
await ifElseNumCall(client, 5) await ifElseNumCall(client, 5)
} }

View File

@ -4,4 +4,4 @@ import {getPeerExternalAddresses} from "./compiled/some";
export async function onCall(client: FluenceClient) { export async function onCall(client: FluenceClient) {
const addresses = await getPeerExternalAddresses(client, client.relayPeerId!) const addresses = await getPeerExternalAddresses(client, client.relayPeerId!)
console.log("Addresses: ", addresses); console.log("Addresses: ", addresses);
} }

View File

@ -9,4 +9,4 @@ export async function parCall(client: FluenceClient) {
await parFunc(client, client.relayPeerId!, (c) => { await parFunc(client, client.relayPeerId!, (c) => {
console.log("parFunc. external addresses par: " + c.external_addresses) console.log("parFunc. external addresses par: " + c.external_addresses)
}) })
} }