Struktur kode JavaScript dan berkas JSON untuk pemetaan data game rp789.
{ } catalog-config.js{ } catalog-config.json
Salin kode
JavaScript
// Konfigurasi objek lokal katalog game rp789
const rp789Catalog = {
brand: 'rp789' ,
platform: 'android' ,
defaultGame: '118' ,
items: [
{ id: '118' , name: 'Lucky Piggy' , category: 'Slot' },
{ id: '049' , name: 'Dragon Tiger Luck' , category: 'Slot' },
{ id: '148' , name: 'Dragon Hatch2' , category: 'Slot' },
{ id: '083' , name: 'Fortune Ox' , category: 'Slot' },
{ id: '183' , name: 'Skylight Wonder' , category: 'Slot' }
]
};
function getGameInfo(id) {
return rp789Catalog.items.find(item => item.id === id) || null ;
}
// Uji pemanggilan konfigurasi statis
const selected = getGameInfo(rp789Catalog.defaultGame);
console.log('Katalog terpilih:' , selected.name); JSON
{
"brand" : "rp789" ,
"platform" : "android" ,
"defaultGame" : "118" ,
"items" : [
{
"id" : "118" ,
"name" : "Lucky Piggy" ,
"category" : "Slot"
},
{
"id" : "049" ,
"name" : "Dragon Tiger Luck" ,
"category" : "Slot"
},
{
"id" : "148" ,
"name" : "Dragon Hatch2" ,
"category" : "Slot"
},
{
"id" : "083" ,
"name" : "Fortune Ox" ,
"category" : "Slot"
},
{
"id" : "183" ,
"name" : "Skylight Wonder" ,
"category" : "Slot"
}
]
}