Add deprecation for Discourse.PageTracker
This commit is contained in:
parent
750a3ce5e5
commit
b587bc580f
|
@ -140,3 +140,18 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
|||
|
||||
// TODO: Remove this, it is in for backwards compatibiltiy with plugins
|
||||
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 });
|
||||
|
|
|
@ -7,28 +7,5 @@ export default {
|
|||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue