From 9739201e7355f56ced9eddbf7167d3530591e859 Mon Sep 17 00:00:00 2001 From: Stefan Vizzari Date: Thu, 14 Sep 2017 21:47:58 +1000 Subject: [PATCH 1/3] feature(settings): add getter for unofficial settings object --- lib/javascripts/base_app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/javascripts/base_app.js b/lib/javascripts/base_app.js index 54b7809..83cd69d 100644 --- a/lib/javascripts/base_app.js +++ b/lib/javascripts/base_app.js @@ -226,6 +226,12 @@ BaseApp.extend = function(appPrototype) { App.prototype = _.extend({}, BaseApp.prototype, appPrototype); + Object.defineProperty(App.prototype, "settings", { + get() { + return this._metadata.settings; + } + }); + return App; }; From f5aa1d43ba92150dac5660fbf255abce138c4df2 Mon Sep 17 00:00:00 2001 From: Stefan Vizzari Date: Fri, 6 Oct 2017 12:02:16 +1100 Subject: [PATCH 2/3] doc(settings): add comment to explain why settings is added this way --- lib/javascripts/base_app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/javascripts/base_app.js b/lib/javascripts/base_app.js index 83cd69d..e752c91 100644 --- a/lib/javascripts/base_app.js +++ b/lib/javascripts/base_app.js @@ -226,6 +226,11 @@ BaseApp.extend = function(appPrototype) { App.prototype = _.extend({}, BaseApp.prototype, appPrototype); + // settings is an alias provided so that any apps that attempt + // direct access of the object underlying the setting API. See + // https://developer.zendesk.com/apps/docs/agent/data#setting + // we define this property after extending BaseApp so that the + // accessor won't be called before the app is instanciated Object.defineProperty(App.prototype, "settings", { get() { return this._metadata.settings; From 4c42027fb838a61caa9e1c3d0feb4915035c74dc Mon Sep 17 00:00:00 2001 From: Stefan Vizzari Date: Mon, 9 Oct 2017 12:19:13 +1100 Subject: [PATCH 3/3] chore(typo): correct spelling --- lib/javascripts/base_app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/javascripts/base_app.js b/lib/javascripts/base_app.js index e752c91..8338c5e 100644 --- a/lib/javascripts/base_app.js +++ b/lib/javascripts/base_app.js @@ -230,7 +230,7 @@ BaseApp.extend = function(appPrototype) { // direct access of the object underlying the setting API. See // https://developer.zendesk.com/apps/docs/agent/data#setting // we define this property after extending BaseApp so that the - // accessor won't be called before the app is instanciated + // accessor won't be called before the app is instantiated Object.defineProperty(App.prototype, "settings", { get() { return this._metadata.settings;