39 lines
857 B
JavaScript
39 lines
857 B
JavaScript
/**
|
|
* Handle new game already selected.
|
|
*
|
|
* @param {Object} initialContent With gameName, gamePlatformId and gameGenreId field.
|
|
* @returns {Object}
|
|
*/
|
|
export function GameSelector(){
|
|
return {
|
|
|
|
/**
|
|
* Game Name
|
|
* @type {string|null}
|
|
*/
|
|
name: null,
|
|
|
|
/**
|
|
* Game Platform Id.
|
|
* @type {number|null}
|
|
*/
|
|
platformId: null,
|
|
|
|
/**
|
|
* Game genre Id.
|
|
* @type {number|null}
|
|
*/
|
|
genreId: null,
|
|
|
|
/**
|
|
* Initialize game selector.
|
|
* @param initialContent
|
|
*/
|
|
init( initialContent = {} ){
|
|
this.name = initialContent.name ?? null;
|
|
this.platformId = Number(initialContent.platformId) ?? null;
|
|
this.genreId = Number(initialContent.genreId) ?? null;
|
|
}
|
|
}
|
|
}
|