From 5432ef3b5eade232be19229e8016a20352a01d22 Mon Sep 17 00:00:00 2001 From: cahrens Date: Fri, 4 Mar 2016 13:40:18 -0500 Subject: [PATCH] Make it clear that the logger methods are used by xblocks. --- common/static/js/spec/logger_spec.js | 6 ++++++ common/static/js/src/logger.js | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/common/static/js/spec/logger_spec.js b/common/static/js/spec/logger_spec.js index eb97773822..8c9d2ecc85 100644 --- a/common/static/js/spec/logger_spec.js +++ b/common/static/js/spec/logger_spec.js @@ -6,6 +6,8 @@ }); describe('log', function() { + // Note that log is used by external XBlocks, and the API cannot change without + // proper deprecation and notification for external authors. it('can send a request to log event', function() { spyOn(jQuery, 'ajaxWithPrefix'); Logger.log('example', 'data'); @@ -106,6 +108,8 @@ }); describe('listen', function() { + // Note that listen is used by external XBlocks, and the API cannot change without + // proper deprecation and notification for external authors. beforeEach(function () { spyOn(jQuery, 'ajaxWithPrefix'); this.callbacks = _.map(_.range(4), function () { @@ -146,6 +150,8 @@ }); describe('bind', function() { + // Note that bind may be used by external XBlocks, and the API cannot change without + // proper deprecation and notification for external authors. beforeEach(function() { this.initialPostWithPrefix = jQuery.postWithPrefix; this.initialGetWithPrefix = jQuery.getWithPrefix; diff --git a/common/static/js/src/logger.js b/common/static/js/src/logger.js index c9412e872e..16b90cf45d 100644 --- a/common/static/js/src/logger.js +++ b/common/static/js/src/logger.js @@ -24,6 +24,9 @@ return { /** * Emits an event. + * + * Note that this method is used by external XBlocks, and the API cannot change without + * proper deprecation and notification for external authors. */ log: function(eventType, data, element, requestOptions) { var callbacks; @@ -62,7 +65,10 @@ /** * Adds a listener. If you want any element to trigger this listener, - * do element = null + * do element = null. + * + * Note that this method is used by external XBlocks, and the API cannot change without + * proper deprecation and notification for external authors. */ listen: function(eventType, element, callback) { listeners[eventType] = listeners[eventType] || {}; @@ -72,6 +78,9 @@ /** * Binds `page_close` event. + * + * Note that this method is used by external XBlocks, and the API cannot change without + * proper deprecation and notification for external authors. */ bind: function() { window.onunload = function() {