A major theme of the forthcoming Design Patterns in Dart is that design patterns are more useful for describing how systems are already designed, not for designing systems in the first place. The implications and applicability of patterns then aid programmers to understand how systems can evolve, once patterns are recognized in them.
With that in mind... consider a
<div> with ID of "bottom" inside a <div> with ID of "middle" inside a <div> with ID of "top":
There are three Dart element objects:
  var bottom = query('#bottom'),
    middle = query('#middle'),
    top = query('#top');  bottom.onClick.listen((e){
    if (e.ctrlKey) return;
    if (e.shiftKey) return;
    bottom.style.border =
      bottom.style.border.contains('green') ?
        '' : '3px green dashed';
    e.stopPropagation();
  });<div>, the request passes along to the successor. The next element object in line here is the "middle"   middle.onClick.listen((e){
    if (e.ctrlKey) return;
    middle.style.border =
      middle.style.border.contains('blue') ?
        '' : '3px blue dashed';
    e.stopPropagation();
  });bottom handler and the middle handler—both of which opt not to handle the request. In this case, the request is finally handled by top:  top.onClick.listen((_){
    top.style.border =
      top.style.border.contains('orange') ?
        '' : '3px orange dotted';
  });And the implications and applicability? Well, that's a tale for another day.
Play with the code on DartPad: https://dartpad.dartlang.org/12bf7fa9c76c6d16fe5f.
Day #98
 
MY HOMEPAGE1
ReplyDeleteMY HOMEPAGE2
MY HOMEPAGE3
MY HOMEPAGE4
MY HOMEPAGE5