Loader

Loader

The Loader allows creating a Semantic Chess instance via information loaded from an url.

Constructor

new Loader(fetch:)

This constructor creates an instance of Loader.
Source:
Parameters:
Name Type Description
fetch: the function used to fetch the data

Methods

(async) _getObjectFromPredicateForResource(url:, predicate:) → {Promise}

This method returns the object of resource via a predicate.
Source:
Parameters:
Name Type Description
url: the url of the resource.
predicate: the predicate for which to look.
Returns:
Type:
Promise
: a promise that resolves with the object or null if none is found.

(async) findWebIdOfOpponent(gameUrl:, userWebId:) → {Promise}

This method returns the WebId of the opponent.
Source:
Parameters:
Name Type Description
gameUrl: the url of the game
userWebId: the WebId of the user
Returns:
Type:
Promise
: a promise that resolves with the WebId of the opponent or null if not found

(async) loadFromUrl(gameUrl:, userWebId:, moveBaseUrl:) → {SemanticChess}

This method creates a instance of Semantic Chess, based on a URL that describes the game.
Source:
Parameters:
Name Type Description
gameUrl: string the url that represents the game
userWebId: string the WebId of the user
moveBaseUrl: string | function base url used to create urls for new moves
Returns:
Type:
SemanticChess
: an instance of SemanticChess