### Initialize User Application with Webasyst Installation Source: https://github.com/1312inc/webasyst-x-electron/blob/master/README.md Use the ready method to access the installation object once the application has loaded. ```javascript window.appState.ready((installation) => { console.log(installation.name) }) ``` -------------------------------- ### Fetch and Display Photos via Webasyst API Source: https://github.com/1312inc/webasyst-x-electron/blob/master/app/index.html Initializes the application state and retrieves a list of photos using the photos.photo.getList method. ```javascript window.appState.ready(async (installation) => { const list = document.getElementById('installationProps') for (const prop in installation) { const row = document.createElement('tr') row.innerHTML = `${prop}:${installation[prop]}` list.appendChild(row) } try { const photos = await fetchJSON(`${installation.url}/api.php/photos.photo.getList`) const photosList = document.getElementById('photosList') for (const i of photos) { const item = document.createElement('div') item.classList.add('width-25', 'custom-p-8') item.innerHTML = `
${i.name}
` photosList.appendChild(item) } const photosContainer = document.querySelector('.photos') if (photosContainer) { photosContainer.style.display = 'block' } } catch (e) {} async function fetchJSON (url) { const response = await fetch(url, { method: 'get', headers: { Authorization: `Bearer ${installation.accessToken}` } }) const items = await response.json() return items.photos } }) ``` -------------------------------- ### CSS Styling for Photo Elements Source: https://github.com/1312inc/webasyst-x-electron/blob/master/app/index.html Defines the layout and appearance for photo containers. ```css .photo { background-color: #fff; object-fit: contain; width: 100%; height: 200px; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.