mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-05-13 18:01:19 +00:00
Add ttl argument to some "builtin" functions (#17)
This commit is contained in:
parent
2fb5ffeb06
commit
ceca3e5692
@ -65,7 +65,7 @@ const requestResponse = async <T>(
|
|||||||
* @param { FluenceClient } client - The Fluence Client instance.
|
* @param { FluenceClient } client - The Fluence Client instance.
|
||||||
* @returns { Array<string> } - list of available modules on the connected relay
|
* @returns { Array<string> } - list of available modules on the connected relay
|
||||||
*/
|
*/
|
||||||
export const getModules = async (client: FluenceClient): Promise<string[]> => {
|
export const getModules = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
|
||||||
let callbackFn = "getModules"
|
let callbackFn = "getModules"
|
||||||
const particle = new Particle(
|
const particle = new Particle(
|
||||||
`
|
`
|
||||||
@ -78,6 +78,7 @@ export const getModules = async (client: FluenceClient): Promise<string[]> => {
|
|||||||
__relay: client.relayPeerId,
|
__relay: client.relayPeerId,
|
||||||
myPeerId: client.selfPeerId,
|
myPeerId: client.selfPeerId,
|
||||||
},
|
},
|
||||||
|
ttl
|
||||||
);
|
);
|
||||||
|
|
||||||
return sendParticleAsFetch(client, particle, callbackFn);
|
return sendParticleAsFetch(client, particle, callbackFn);
|
||||||
@ -88,7 +89,7 @@ export const getModules = async (client: FluenceClient): Promise<string[]> => {
|
|||||||
* @param { FluenceClient } client - The Fluence Client instance.
|
* @param { FluenceClient } client - The Fluence Client instance.
|
||||||
* @returns { Array<string> } - list of available modules on the connected relay
|
* @returns { Array<string> } - list of available modules on the connected relay
|
||||||
*/
|
*/
|
||||||
export const getInterfaces = async (client: FluenceClient): Promise<string[]> => {
|
export const getInterfaces = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
|
||||||
let callbackFn = "getInterfaces"
|
let callbackFn = "getInterfaces"
|
||||||
const particle = new Particle(
|
const particle = new Particle(
|
||||||
`
|
`
|
||||||
@ -101,6 +102,7 @@ export const getInterfaces = async (client: FluenceClient): Promise<string[]> =>
|
|||||||
__relay: client.relayPeerId,
|
__relay: client.relayPeerId,
|
||||||
myPeerId: client.selfPeerId,
|
myPeerId: client.selfPeerId,
|
||||||
},
|
},
|
||||||
|
ttl
|
||||||
);
|
);
|
||||||
|
|
||||||
return sendParticleAsFetch(client, particle, callbackFn);
|
return sendParticleAsFetch(client, particle, callbackFn);
|
||||||
@ -118,6 +120,7 @@ export const uploadModule = async (
|
|||||||
name: string,
|
name: string,
|
||||||
moduleBase64: string,
|
moduleBase64: string,
|
||||||
config?: ModuleConfig,
|
config?: ModuleConfig,
|
||||||
|
ttl?: number,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = {
|
config = {
|
||||||
@ -146,7 +149,7 @@ export const uploadModule = async (
|
|||||||
)
|
)
|
||||||
`;
|
`;
|
||||||
|
|
||||||
return sendParticleAsFetch(client, new Particle(script, data), 'getModules', "_callback");
|
return sendParticleAsFetch(client, new Particle(script, data, ttl), 'getModules', "_callback");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user