public ProfilerViewModel(IBrowsingContext context)
 {
     _time    = new Stopwatch();
     _tracker = new Dictionary <Object, TimeSpan>();
     _context = context;
     _model   = CreateModel();
     _context.AddEventListener(EventNames.Parsing, TrackParsing);
     _context.AddEventListener(EventNames.Parsed, TrackParsed);
     _context.AddEventListener(EventNames.Requesting, TrackRequesting);
     _context.AddEventListener(EventNames.Requested, TrackRequested);
 }
 private void Register <T>(Action <T> listener)
     where T : Event
 {
     _context.AddEventListener(EventNames.Error, (obj, ev) =>
     {
         if (ev is T data)
         {
             listener.Invoke(data);
         }
     });
 }