mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-23 17:42:46 +01:00
23 lines
702 B
JavaScript
23 lines
702 B
JavaScript
// noinspection JSUnusedGlobalSymbols
|
|
|
|
import { replaceFunction } from "../api/patch.js";
|
|
import { TD } from "../api/td.js";
|
|
import { ensurePropertyExists } from "../api/utils.js";
|
|
|
|
/**
|
|
* Limits amount of loaded DMs to avoid massive lag from re-opening them several times.
|
|
*/
|
|
export default function() {
|
|
ensurePropertyExists(TD, "services", "TwitterConversation", "prototype");
|
|
|
|
replaceFunction(TD.services.TwitterConversation.prototype, "renderThread", /** @this TwitterConversation */ function(func, args) {
|
|
const prevMessages = this.messages;
|
|
|
|
this.messages = prevMessages.slice(0, 100);
|
|
const result = func.apply(this, args);
|
|
this.messages = prevMessages;
|
|
|
|
return result;
|
|
});
|
|
};
|