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

This commit is contained in:
jaysunxiao committed 2022-05-16 21:00:00 +08:00
1 parent 29ee2b0d90
commit 49aaebdd20
2 files changed
+10 -25

No files matched your search

@@ -1,5 +1,4 @@
{ {}
}
const protocols = new Map(); const protocols = new Map();
@@ -28,8 +27,7 @@ ProtocolManager.read = function read(buffer) {
}; };
ProtocolManager.initProtocol = function initProtocol() { ProtocolManager.initProtocol = function initProtocol() {
{ {}
}
}; };
export default ProtocolManager; export default ProtocolManager;
@@ -1,38 +1,25 @@
{ {}
} const {} = function({}) {
const {} = function ({}) { {}
{
}
}; };
{ {}.prototype.protocolId = function() {
}
.
prototype.protocolId = function () {
return {}; return {};
}; };
{ {}.write = function(buffer, packet) {
}
.
write = function (buffer, packet) {
if (buffer.writePacketFlag(packet)) { if (buffer.writePacketFlag(packet)) {
return; return;
} }
{ {}
}
}; };
{ {}.read = function(buffer) {
}
.
read = function (buffer) {
if (!buffer.readBoolean()) { if (!buffer.readBoolean()) {
return null; return null;
} }
const packet = new {}(); const packet = new {}();
{ {}
}
return packet; return packet;
}; };