2022-10-19 00:04:19 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { ViewModel } = require('hydrogen-view-sdk');
|
|
|
|
|
2022-10-27 00:09:13 -06:00
|
|
|
class ModalViewModel extends ViewModel {
|
2022-10-19 00:04:19 -06:00
|
|
|
constructor(options) {
|
|
|
|
super(options);
|
|
|
|
const { title, contentViewModel, closeCallback, open = false } = options;
|
|
|
|
|
|
|
|
this._open = open;
|
|
|
|
this._title = title;
|
|
|
|
this._contentViewModel = contentViewModel;
|
|
|
|
this._closeCallback = closeCallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
get open() {
|
|
|
|
return this._open;
|
|
|
|
}
|
|
|
|
|
|
|
|
setOpen(newOpen) {
|
|
|
|
this._open = newOpen;
|
|
|
|
this.emitChange('open');
|
|
|
|
}
|
|
|
|
|
|
|
|
get title() {
|
|
|
|
return this._title;
|
|
|
|
}
|
|
|
|
|
|
|
|
get contentViewModel() {
|
|
|
|
return this._contentViewModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
get closeCallback() {
|
|
|
|
return this._closeCallback;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-27 00:09:13 -06:00
|
|
|
module.exports = ModalViewModel;
|