From cad4ab9cb510b84669f8bef5a0411878bbb421d0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 17 Nov 2017 11:02:29 +0300 Subject: [PATCH] [DE] Refactoring sing dialog. --- apps/common/main/lib/view/SignDialog.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/common/main/lib/view/SignDialog.js b/apps/common/main/lib/view/SignDialog.js index c44c3bd1e..cc298bc78 100644 --- a/apps/common/main/lib/view/SignDialog.js +++ b/apps/common/main/lib/view/SignDialog.js @@ -248,8 +248,11 @@ define([ },500); }, - hide: function() { - Common.UI.Window.prototype.hide.apply(this, arguments); + close: function() { + this.api.asc_unregisterCallback('on_signature_defaultcertificate_ret', this.binding.certificateChanged); + this.api.asc_unregisterCallback('on_signature_selectsertificate_ret', this.binding.certificateChanged); + + Common.UI.Window.prototype.close.apply(this, arguments); if (this.signObject) this.signObject.destroy(); @@ -257,10 +260,11 @@ define([ afterRender: function () { if (this.api) { - this.api.asc_unregisterCallback('on_signature_defaultcertificate_ret', _.bind(this.onCertificateChanged, this)); - this.api.asc_registerCallback('on_signature_defaultcertificate_ret', _.bind(this.onCertificateChanged, this)); - this.api.asc_unregisterCallback('on_signature_selectsertificate_ret', _.bind(this.onCertificateChanged, this)); - this.api.asc_registerCallback('on_signature_selectsertificate_ret', _.bind(this.onCertificateChanged, this)); + this.binding = { + certificateChanged: _.bind(this.onCertificateChanged, this) + }; + this.api.asc_registerCallback('on_signature_defaultcertificate_ret', this.binding.certificateChanged); + this.api.asc_registerCallback('on_signature_selectsertificate_ret', this.binding.certificateChanged); this.api.asc_GetDefaultCertificate(); }