mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
Add deprecation for Discourse.PageTracker
This commit is contained in:
parent
750a3ce5e5
commit
b587bc580f
2 changed files with 15 additions and 23 deletions
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue