diff --git a/package.json b/package.json index 660828e..067b24c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "name": "FileDocumentViewer", - "version": "2.2.3", + "version": "2.2.4", "description": "This widget lets you view file documents.", "license": "", "author": "", "private": true, - "dependencies": { - }, + "dependencies": {}, "devDependencies": { "del": "^2.2.2", "gulp": "^3.9.1", @@ -35,4 +34,4 @@ "folders": "node ./node_modules/gulp/bin/gulp folders", "modeler": "node ./node_modules/gulp/bin/gulp modeler" } -} +} \ No newline at end of file diff --git a/src/FileDocumentViewer/widget/FileDocumentViewer.js b/src/FileDocumentViewer/widget/FileDocumentViewer.js index c9215ca..f142cba 100644 --- a/src/FileDocumentViewer/widget/FileDocumentViewer.js +++ b/src/FileDocumentViewer/widget/FileDocumentViewer.js @@ -68,7 +68,7 @@ require( [ this._resetSubscriptions(); this._updateRendering(callback); } else { - mendix.lang.nullExec(callback); + this._executeCallback(callback, "update"); } }, @@ -94,18 +94,18 @@ require( [ domAttr.set(this.headerTextNode, "innerHTML","..."); } - mendix.lang.nullExec(callback); + this._executeCallback(callback, "_updateRendering"); }, _resetSubscriptions: function () { logger.debug(this.id + "._resetSubscriptions"); if (this._handle) { - mx.data.unsubscribe(this._handle); + this.unsubscribe(this._handle); this._handle = null; } if (this._contextObj) { - this._handle = mx.data.subscribe({ + this._handle = this.subscribe({ guid: this._contextObj.getGuid(), callback: lang.hitch(this, function () { this._updateRendering(); @@ -143,10 +143,17 @@ require( [ uninitialize: function () { if (this._handle) { - mx.data.unsubscribe(this._handle); + this.unsubscribe(this._handle); this._handle = null; } logger.debug(this.id + ".uninitialize"); + }, + + _executeCallback: function (cb, from) { + logger.debug(this.id + "._executeCallback" + (from ? " from " + from : "")); + if (cb && typeof cb === "function") { + cb(); + } } }); }); diff --git a/src/package.xml b/src/package.xml index ae189c8..277f295 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/test/widgets/FileDocumentViewer.mpk b/test/widgets/FileDocumentViewer.mpk index eaaddec..c7460d5 100644 Binary files a/test/widgets/FileDocumentViewer.mpk and b/test/widgets/FileDocumentViewer.mpk differ