Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module networking;
- import std.stdio, std.json;
- static class Networking {
- static:
- void delegate(JSONValue data)[string] handlers;
- void registerHandler(string type, void delegate(JSONValue data) dg) {
- handlers[type] = dg;
- }
- void handle(string type, JSONValue data) {
- if(auto dg = type in data)
- dg(data);
- else
- writeln("No handler for type: ", type);
- }
- }
- static shared this() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement