Initial commit
This commit is contained in:
37
resources/js/SubmissionsClass/Credits.js
Normal file
37
resources/js/SubmissionsClass/Credits.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/** @typedef { import('types/CreditsObject.js').CreditsObject} CreditsObject */
|
||||
|
||||
export function Credits(){
|
||||
return {
|
||||
|
||||
/**
|
||||
* Credits. Preloaded at startup.
|
||||
* @type {CreditsObject[]}
|
||||
*/
|
||||
credits: [],
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string|null} jsonCredits
|
||||
*/
|
||||
init( jsonCredits= null ){
|
||||
if( jsonCredits !== null ){
|
||||
this.credits = JSON.parse(jsonCredits);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an empty credit.
|
||||
*/
|
||||
addEmptyCredits() {
|
||||
this.credits.push({name: '', description: ''});
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a specific credits.
|
||||
* @param {number} index index of credit.
|
||||
*/
|
||||
removeCredits( index ){
|
||||
this.credits.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user