signal-desktop/js/views/banner_view.js

39 lines
850 B
JavaScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2017-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* global Whisper, $ */
// eslint-disable-next-line func-names
(function () {
2018-04-27 21:25:04 +00:00
window.Whisper = window.Whisper || {};
2018-04-27 21:25:04 +00:00
Whisper.BannerView = Whisper.View.extend({
className: 'banner',
template: () => $('#banner').html(),
2018-04-27 21:25:04 +00:00
events: {
'click .dismiss': 'onDismiss',
'click .body': 'onClick',
},
initialize(options) {
2018-04-27 21:25:04 +00:00
this.message = options.message;
this.callbacks = {
onDismiss: options.onDismiss,
onClick: options.onClick,
};
this.render();
},
render_attributes() {
2018-04-27 21:25:04 +00:00
return {
message: this.message,
};
},
onDismiss(e) {
2018-04-27 21:25:04 +00:00
this.callbacks.onDismiss();
e.stopPropagation();
},
onClick() {
2018-04-27 21:25:04 +00:00
this.callbacks.onClick();
},
});
})();