viewof request = {
const requests = [];
const value = REQUEST;
const self = htl.html`<div>${TEMPLATE()}`;
return Object.defineProperties(self, {
value: {
get: () => value,
},
});
function RENDER() {
self.replaceChildren(TEMPLATE());
self.dispatchEvent(new CustomEvent('input',));
};
function REQUEST(url, options={}) {
requests.push(url, options);
RENDER();
};
function TEMPLATE() {
return htl.html`
<table>
<thead>
<th>Actions
<th>URL
<tbody>
${requests.map((request) => htl.html.fragment`
<tr>
<td>
<button onclick=${() => APPROVE(request)}>Approve</button>
<button onclick=${() => DENY(request)}>Deny</button>
<td>${request.url}
`)}
`;
};
function APPROVE() {};
function DENY() {};
};