#include server.js const MamiCompat = (current, path, handler) => { if(typeof path !== 'string') throw 'path must be a string'; if(typeof handler !== 'function') throw 'handler must be a function'; path = path.split('.'); const final = path.pop(); if(final === undefined) throw 'invalid path'; for(const part of path) { if(!(part in current)) current[part] = {}; current = current[part]; } if(!(final in current)) current[final] = handler; }; // Backwards compat for scripts // Keep in sync with for as long as possible MamiCompat(Umi, 'Server.SendMessage', Umi.Server.sendMessage.bind(Umi.Server)); MamiCompat(Umi, 'Protocol.SockLegacy.Protocol.Instance.SendMessage', Umi.Server.sendMessage.bind(Umi.Server)); MamiCompat(Umi, 'Parser.SockChatBBcode.EmbedStub', function() {}); // intentionally a no-op MamiCompat(Umi, 'UI.View.SetText', function() { console.log('Umi.UI.View.SetText called'); }); MamiCompat(Umi, 'UI.Menus.Add', function() { console.log('Umi.UI.Menus.Add called'); }); MamiCompat(Umi, 'UI.Menus.Get', function() { console.log('Umi.UI.Menus.Get called'); });