Skip to content

Commit cb7e40d

Browse files
Add new setAlertParent function (#207)
1 parent 0387429 commit cb7e40d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/components/alert.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
// =============================================================================
55

66

7-
import {$body, $N, CustomElementView, register} from '../';
7+
import {$body, $N, CustomElementView, register, HTMLView} from '../';
88

99
let $openAlert: Alert|undefined;
10-
const $alertParent = $N('div', {class: 'snackbar'}, $body);
10+
let $alertParent = $N('div', {class: 'snackbar'}, $body);
11+
12+
/**
13+
* Sets the container element where new alerts will be appended.
14+
* @param parent - The HTMLView element to use as the alert container
15+
*/
16+
export function setAlertParent(parent: HTMLView) {
17+
$alertParent = parent;
18+
}
1119

1220

1321
@register('x-alert')

0 commit comments

Comments
 (0)