Add deprecation for Discourse.PageTracker

This commit is contained in:
Robin Ward 2015-08-11 14:07:08 -04:00
parent 750a3ce5e5
commit b587bc580f
2 changed files with 15 additions and 23 deletions

View File

@ -140,3 +140,18 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
// TODO: Remove this, it is in for backwards compatibiltiy with plugins // TODO: Remove this, it is in for backwards compatibiltiy with plugins
Discourse.HasCurrentUser = {}; Discourse.HasCurrentUser = {};
function proxyDep(propName, moduleFunc, msg) {
if (Discourse.hasOwnProperty(propName)) { return; }
Object.defineProperty(Discourse, propName, {
get: function() {
msg = msg || "import the module";
Ember.warn("DEPRECATION: `Discourse." + propName + "` is deprecated, " + msg + ".");
return moduleFunc();
}
});
}
proxyDep('computed', function() { return require('discourse/lib/computed') });
proxyDep('Formatter', function() { return require('discourse/lib/formatter') });
proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default });

View File

@ -7,28 +7,5 @@ export default {
require(entry, null, null, true); require(entry, null, null, true);
} }
}); });
// TODO: Once things have migrated remove these
if (!Discourse.hasOwnProperty('computed')) {
const computed = require('discourse/lib/computed');
Object.defineProperty(Discourse, 'computed', {
get: function() {
Ember.warn('DEPRECATION: `Discourse.computed` is deprecated, import the functions as needed.');
return computed;
}
});
}
if (!Discourse.hasOwnProperty('Formatter')) {
const Formatter = require('discourse/lib/formatter');
Object.defineProperty(Discourse, 'Formatter', {
get: function() {
Ember.warn('DEPRECATION: `Discourse.Formatter` is deprecated, import the formatters as needed.');
return Formatter;
}
});
}
} }
}; };