Customization
News feed
You can use News to get the news from your EML AdminTool website and display them in your Launcher.
Warning
Bootstraps requires an EML AdminTool website to work.
import { News } from 'eml-lib'
news()
async function news() {
const news = new News('https://at.emlproject.pages.dev')
try {
const newsList = await news.getNews()
} catch (err) {
console.error(err)
}
} News constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website. | Yes |
News.getNews() method
Get all the news from the EML AdminTool.
Returns: Promise<INews[]> - The news.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
News.getCategories() method
Get all the News categories from the EML AdminTool.
Returns: Promise<INewsCategory[]> - The news categories.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
News.getNewsByCategory() method
News.getNewsByCategory()Warning
This method is currently deprecated, and returns an empty array.
The EML AdminTool API does not support News.getNewsByCategory() anymore, but may be used in the future. Please use News.getNews().filter(...) instead.
Background customization
You can use Background to get the background from your EML AdminTool website and display it in your Launcher.
Warning
Background requires an EML AdminTool website to work.
import { Background } from 'eml-lib'
background()
async function background() {
const background = new Background('https://at.emlproject.pages.dev')
try {
const currentBackground = await background.getBackground()
} catch (err) {
console.error(err)
}
} Background constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website. | Yes |
Background.getBackground() method
Get the current Background from the EML AdminTool.
Returns: Promise<null> - No background (you should include in your Launcher a default background) • Promise<IBackground> - The background information if a background is set.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.