perf[protocol]: 使用模板生成协议

This commit is contained in:
jaysunxiao
2022-05-16 21:00:00 +08:00
parent 29ee2b0d90
commit 49aaebdd20
2 changed files with 10 additions and 25 deletions
@@ -1,5 +1,4 @@
{
}
{}
const protocols = new Map();
@@ -28,8 +27,7 @@ ProtocolManager.read = function read(buffer) {
};
ProtocolManager.initProtocol = function initProtocol() {
{
}
{}
};
export default ProtocolManager;
@@ -1,38 +1,25 @@
{
}
const {} = function ({}) {
{
}
{}
const {} = function({}) {
{}
};
{
}
.
prototype.protocolId = function () {
{}.prototype.protocolId = function() {
return {};
};
{
}
.
write = function (buffer, packet) {
{}.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
{
}
{}
};
{
}
.
read = function (buffer) {
{}.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new {}();
{
}
{}
return packet;
};