Vitaliy977
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Death_INN Цитата:| Далее тестирую на вашем загрузчике "свой" скрипт с функцией notify, так пишет вообще ошибку, что this is null. | Похоже как то так делали? setTimeout(UcfPrefs.closeAlert, 500, "ucf-test"); но вот так все работает setTimeout(() => UcfPrefs.closeAlert("ucf-test"), 500); так что это не важно Цитата:| Заодно в геттере showAlert добавил дефолт, но с приоритетом для opts | Для alert.initWithObject добавили а для старых FF в alert.init ? Или вам это не нужно, но можно как то так Код: var def = {textClickable: true, cookie: "", requireInteraction: true, silent: true}; return this.showAlert = (opts = {}, obs) => { var {name, imageURL, title, text, textClickable, cookie, dir, lang, data, principal, inPrivateBrowsing, requireInteraction, silent, vibrate = [], actions, opaqueRelaunchData} = {...def, ...opts}; var alert = new notification(); alert.init(name, imageURL, title, text, textClickable, cookie, dir, lang, data, principal, inPrivateBrowsing, requireInteraction, silent, vibrate); if (actions) alert.actions = actions; if (opaqueRelaunchData) alert.opaqueRelaunchData = opaqueRelaunchData; alertsService.showAlert(alert, obs); }; | |