Qworum-for-Web-Pages

class Call extends Instruction

static build(object, href, parameters, objectParameters)

🏷 @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

getter href

getter object

getter objectParameters

getter parameters

toString()

🏷 @return {string}

class Data extends Instruction

static build(path, statement)

🏷 @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

getter path

toString()

🏷 @return {string}

class Fault extends Instruction

static build(type)

🏷 @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()

🏷 @return {string}

getter type

class Goto extends Instruction

static build(href)

🏷 @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

getter href

toString()

🏷 @return {string}

class Json extends GenericData

static build(value)

🏷 @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()

🏷 @return {string}

getter value

class Qworum

static async checkAvailability()

🏷 @static

🏷 @async

🏷 @return {Promise.<null>}

🏷 @example try{

await Qworum.checkAvailability();

}catch(error){

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

}

static async eval(script)

🏷 @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 async getData(path)

🏷 @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 async setData(path, value)

🏷 @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)

🏷 @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()

🏷 @return {string}

class Script

static build(instruction)

🏷 @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

getter instruction

toString()

🏷 @return {string}

class SemanticData extends GenericData

static build()

🏷 @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

async readFromText(text, baseIRI)

🏷 @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

async readFromUrl(url)

🏷 @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)

🏷 @param

{string}

🆔 type

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

🏷 @return {string}

toString()

🏷 @return {string}

getter value

class Sequence extends Instruction

static build()

🏷 @static

🏷 @param

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

🆔 statements

💬 Statements.

🏷 @throws {Error}

🏷 @return {Sequence}

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

🏷 @see

Qworum specification

getter statements

toString()

🏷 @return {string}

class Try extends Instruction

static build(statement, catchClauses)

🏷 @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()

🏷 @return {string}

📅 𝑪𝒂𝒄𝒉𝒆𝒅 𝒐𝒏 𝑴𝒐𝒏 𝑵𝒐𝒗 𝟤𝟧 𝟤𝟢𝟤𝟦 𝟣𝟫:𝟦𝟤:𝟧𝟪 𝑮𝑴𝑻+𝟢𝟣𝟢𝟢 (𝑪𝒆𝒏𝒕𝒓𝒂𝒍 𝑬𝒖𝒓𝒐𝒑𝒆𝒂𝒏 𝑺𝒕𝒂𝒏𝒅𝒂𝒓𝒅 𝑻𝒊𝒎𝒆)