Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class Popup {
- constructor(type, text) {
- this.type = type;
- this.text = text;
- this.onDismiss = undefined;
- }
- show() {
- setTimeout(() => {
- if(this.onDismiss) {
- // THIS IS THE CALLBACK. Passing PopupInstance
- this.onDismiss(this);
- }
- }, 3000);
- }
- setOnDismiss(onDismiss) {
- this.onDismiss = onDismiss;
- }
- }
- export class PopupContainer {
- constructor() {
- debugger;
- this.popupArray = [];
- debugger;
- }
- addPopup(popup) {
- popup.setOnDismiss(this.removePopup);
- this.popupArray.push(popup);
- debugger;
- }
- removePopup(popup) {
- debugger;
- //HERE I NEED TO ACCESS TO popupArray
- this.popupArray.slice(this.popupArray.find(popup), 1);
- }
- get html() {
- let html = 'not';
- for(let i = 0; i < this.popupArray.length; i++) {
- html += "<li>Allo</li>";
- }
- return html;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement