Make it clear that the logger methods are used by xblocks.

This commit is contained in:
cahrens
2016-03-04 13:40:18 -05:00
parent ba06c899de
commit 5432ef3b5e
2 changed files with 16 additions and 1 deletions

View File

@@ -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;

View File

@@ -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() {