mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Widget: Introduce addCloseListener (#2569)
This commit is contained in:
@@ -747,6 +747,7 @@ Vue.component('pretix-overlay', {
|
||||
this.$root.frame_shown = false;
|
||||
this.$root.parent.frame_dismissed = true;
|
||||
this.$root.parent.reload();
|
||||
this.$root.trigger_close_callback();
|
||||
},
|
||||
iframeLoaded: function () {
|
||||
if (this.$root.frame_loading) {
|
||||
@@ -1368,6 +1369,13 @@ var shared_root_methods = {
|
||||
}
|
||||
});
|
||||
},
|
||||
trigger_close_callback: function () {
|
||||
this.$nextTick(function () {
|
||||
for (var i = 0; i < window.PretixWidget._closed.length; i++) {
|
||||
window.PretixWidget._closed[i]()
|
||||
}
|
||||
});
|
||||
},
|
||||
reload: function () {
|
||||
var url;
|
||||
if (this.$root.is_button) {
|
||||
@@ -1791,9 +1799,13 @@ var create_button = function (element) {
|
||||
widgetlist = [];
|
||||
buttonlist = [];
|
||||
window.PretixWidget._loaded = [];
|
||||
window.PretixWidget._closed = [];
|
||||
window.PretixWidget.addLoadListener = function (f) {
|
||||
window.PretixWidget._loaded.push(f);
|
||||
}
|
||||
window.PretixWidget.addCloseListener = function (f) {
|
||||
window.PretixWidget._closed.push(f);
|
||||
}
|
||||
window.PretixWidget.buildWidgets = function () {
|
||||
document.createElement("pretix-widget");
|
||||
document.createElement("pretix-button");
|
||||
|
||||
Reference in New Issue
Block a user