💾 Archived View for qworum-jdoc.ddns.net › qworum-for-web-pages captured on 2024-05-10 at 10:36:37. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2024-06-20)

-=-=-=-=-=-=-

qworum-for-web-pages

class Call extends Instruction

static build(object, href, parameters, objectParameters)

Builder for [Call instructions](https://qworum.net/en/specification/v1/#call).

🏷 @static

🏷 @param

{(string[] | string | null | undefined)}

🆔 object

💬 The path of the Qworum object to call.

🏷 @param

{(string | null | undefined)}

🆔 href

💬 The URL of the end-point to call. Can be a relative or absolute URL.

🏷 @param

{(object | object[] | null | undefined)}

🆔 parameters

💬 Named data value arguments.

🏷 @param

{(object | object[] | null | undefined)}

🆔 objectParameters

💬 Named Qworum object arguments.

🏷 @throws {Error}

🏷 @return {Call}

🏷 @example const call1 = Call.build('@', 'home/');

🏷 @example const call2 = Call.build(

'@', 'home/',

{name: 'current year', value: Json.build(2022)}

);

🏷 @example const call3 = Call.build(

['@'], 'home/',

[{name: 'current year', value: Json.build(2022)}],

[{name: 'object', object: ['@', 'a Qworum object']}]

);

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Data extends Instruction

static build(path, statement)

Builder for [Data instructions](https://qworum.net/en/specification/v1/#data).

🏷 @static

🏷 @param

{(string | string[])}

🆔 path

💬 The path of the data container.

🏷 @param

{(DataValue | Instruction | undefined)}

🆔 statement

💬 An instruction or data value.

🏷 @throws {Error}

🏷 @return {Data}

🏷 @example const data1 = Data.build('data1', Json.build(2022)); // Writing

🏷 @example const data2 = Data.build('data1'); // Reading

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Fault extends Instruction

static build(type)

Builder for [Fault instructions](https://qworum.net/en/specification/v1/#fault). Suitable for service-specific faults only.

🏷 @static

🏷 @param

{(string | undefined)}

🆔 type

💬 The type of the raised fault.

🏷 @throws {TypeError}

🏷 @return {Fault}

🏷 @example const fault = Fault.build('payment cancelled');

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Goto extends Instruction

static build(href)

Builder for [Goto instructions](https://qworum.net/en/specification/v1/#goto).

🏷 @static

🏷 @param

{(string | null | undefined)}

🆔 href

💬 The URL of the new call phase. Can be a relative or absolute URL.

🏷 @throws {Error}

🏷 @return {Goto}

🏷 @example const goto = Goto.build('home/');

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Json extends GenericData

static build(value)

Builder for [Json data values](https://qworum.net/en/specification/v1/#json).

🏷 @static

🏷 @param

{undefined}

🆔 value

💬 A value that can be serialized to JSON.

🏷 @throws {Error}

🏷 @return {Json}

🏷 @example const json = Json.build(2022);

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Qworum

static checkAvailability()

Checks that:

- the Qworum browser extension is installed and running, and

- the website's [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) is part of Qworum's Service Web.

🏷 @static

🏷 @async

🏷 @return {Promise.<null>}

🏷 @example try{

await Qworum.checkAvailability();

}catch(error){

console.error('Qworum browser extension not installed or not enabled.');

}

static eval(script)

Evaluates a Qworum script.

The outcome is one of:

- Redirection to a new URL (the current Qworum session continues).

- Closing of the browser tab after displaying an alert window (the current Qworum session has terminated).

🏷 @static

🏷 @async

🏷 @param

{Script}

🆔 script

💬 undefined

🏷 @return {Promise.<void>}

🏷 @example const

Script = Qworum.Script,

Goto = Qworum.Goto;

await Qworum.eval(

Script(

Goto('next-phase/')

)

);

static getData(path)

Reads a value contained in a data container.

🏷 @static

🏷 @async

🏷 @param

{(string[] | string)}

🆔 path

💬 - The path of the data container.

🏷 @return {Promise.<(Json | SemanticData | null)>}

🏷 @example try{

const result = await Qworum.getData(['a data']);

if (result instanceof Json){

console.info(`The read operation was successful, the result is: ${JSON.stringify(result.value)}`);

} else {

console.info(`The data has not been set yet. Did you call Qworum.getData(['a data']) beforehand ?`);

}

}catch(error){

console.error('An unexpected error has occurred during the read.');

}

static setData(path, value)

Sets the value contained in a data container.

🏷 @static

🏷 @async

🏷 @param

{(string[] | string)}

🆔 path

💬 - The path of the data container.

🏷 @param

{(Json | SemanticData)}

🆔 value

💬 undefined

🏷 @return {Promise.<null>}

🏷 @example try{

await Qworum.setData('year', Qworum.Json(2022));

console.info('The write operation was successful.');

}catch(error){

console.error('The write operation was not successful.');

}

class Return extends Instruction

static build(statement)

Builder for [Return instructions](https://qworum.net/en/specification/v1/#return).

🏷 @static

🏷 @param

{(DataValue | Instruction)}

🆔 statement

💬 The instruction or data value to evaluate.

🏷 @throws {Error}

🏷 @return {Return}

🏷 @example const return1 = Return.build(Json.build(2022));

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Script

static build(instruction)

Builder for [Qworum scripts](https://qworum.net/en/specification/v1/#script).

🏷 @static

🏷 @param

{Instruction}

🆔 instruction

💬 The root instruction to execute.

🏷 @return {Script}

🏷 @example const script =

Script.build(

Sequence.build(

Call.build(["@", "shopping cart"], "https://shopping-cart.example/view/"),

Goto.build("/home/")

)

);

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class SemanticData extends GenericData

static build()

Builder for [semantic data values](https://qworum.net/en/specification/v1/#semantic).

🏷 @static

🏷 @param

{string}

🆔 value

💬 The semantic data value.

🏷 @param

{(string | undefined)}

🆔 type

💬 The type of the semantic data value. One of 'turtle', 'trig', 'n-triples', 'n-quads'. Default is 'turtle'.

🏷 @throws {Error}

🏷 @return {SemanticData}

🏷 @see

Qworum specification

readFromText(text, baseIRI)

Async RDF dataset reader.

🏷 @param

{string}

🆔 text

💬 Text in one of these RDF formats: Turtle, TriG, N-Triples, N-Quads

🏷 @param

{(URL|undefined)}

🆔 baseIRI

💬 The URL of the RDF document

🏷 @return {Promise.<boolean>}

🏷 @async

readFromUrl(url)

Async RDF dataset reader.

🏷 @param

{string}

🆔 text

💬 Text in one of these RDF formats: Turtle, TriG, N-Triples, N-Quads

🏷 @param

{(URL|undefined)}

🆔 baseIRI

💬 The URL of the RDF document

🏷 @return {Promise.<boolean>}

🏷 @async

toRawString(type)

RDF dataset serialiser.

🏷 @param

{string}

🆔 type

💬 One of: turtle, trig, n-triples, n-quads

🏷 @return {string}

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Sequence extends Instruction

static build()

Builder for [Sequence instructions](https://qworum.net/en/specification/v1/#sequence).

🏷 @static

🏷 @param

{(DataValue | Instruction | Array.<(DataValue | Instruction)>)}

🆔 statements

💬 Statements.

🏷 @throws {Error}

🏷 @return {Sequence}

🏷 @example const sequence = Sequence.build(Json.build(2022));

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}

class Try extends Instruction

static build(statement, catchClauses)

Builder function for [Try instructions](https://qworum.net/en/specification/v1/#try).

🏷 @static

🏷 @param

{undefined}

🆔 statement

💬 A statement (instruction or data value) or a non-empty array of statements.

🏷 @param

{undefined}

🆔 catchClauses

💬 One catch clause or an array of catch clauses.

🏷 @throws {Error}

🏷 @return {Try}

🏷 @example const try1 = Try.build(

Call.build('@', 'checkout/'),

[

{catch: ['the cart is empty'], do: Json({})}

]

);

🏷 @see

Qworum specification

toString()

Serialises the object to string for informational purposes.

🏷 @return {string}