⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact 2c74ca74d07e9876b80527d189b2401de679ad881756f64e9bd2386f31f74fb8:


0000: 0a 3c 6c 6f 6f 70 2d 6d 61 6e 69 70 3e 0a 0a 20  .<loop-manip>.. 
0010: 20 3c 75 6c 3e 0a 20 20 20 20 3c 6c 69 20 65 61   <ul>.    <li ea
0020: 63 68 3d 7b 20 69 74 65 6d 2c 20 69 20 69 6e 20  ch={ item, i in 
0030: 69 74 65 6d 73 20 7d 3e 7b 20 69 74 65 6d 20 7d  items }>{ item }
0040: 20 3c 61 20 6f 6e 63 6c 69 63 6b 3d 7b 20 70 61   <a onclick={ pa
0050: 72 65 6e 74 2e 72 65 6d 6f 76 65 20 7d 3e 72 65  rent.remove }>re
0060: 6d 6f 76 65 3c 2f 61 3e 3c 2f 6c 69 3e 0a 20 20  move</a></li>.  
0070: 3c 2f 75 6c 3e 0a 0a 20 20 3c 62 75 74 74 6f 6e  </ul>..  <button
0080: 20 6f 6e 63 6c 69 63 6b 3d 7b 20 74 6f 70 20 7d   onclick={ top }
0090: 3e 54 6f 70 3c 2f 62 75 74 74 6f 6e 3e 0a 20 20  >Top</button>.  
00a0: 3c 62 75 74 74 6f 6e 20 6f 6e 63 6c 69 63 6b 3d  <button onclick=
00b0: 7b 20 62 6f 74 74 6f 6d 20 7d 3e 42 6f 74 74 6f  { bottom }>Botto
00c0: 6d 3c 2f 62 75 74 74 6f 6e 3e 0a 0a 20 20 74 68  m</button>..  th
00d0: 69 73 2e 69 74 65 6d 73 20 3d 20 5b 30 2c 31 2c  is.items = [0,1,
00e0: 32 2c 33 2c 34 2c 35 5d 0a 0a 20 20 62 6f 74 74  2,3,4,5]..  bott
00f0: 6f 6d 28 65 29 20 7b 0a 20 20 20 20 74 68 69 73  om(e) {.    this
0100: 2e 69 74 65 6d 73 2e 70 75 73 68 28 31 30 30 29  .items.push(100)
0110: 0a 20 20 7d 0a 0a 20 20 74 6f 70 28 29 20 7b 0a  .  }..  top() {.
0120: 20 20 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 75      this.items.u
0130: 6e 73 68 69 66 74 28 31 30 30 29 0a 20 20 7d 0a  nshift(100).  }.
0140: 0a 20 20 72 65 6d 6f 76 65 28 65 29 20 7b 0a 20  .  remove(e) {. 
0150: 20 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 73 70     this.items.sp
0160: 6c 69 63 65 28 65 2e 69 74 65 6d 2e 69 2c 20 31  lice(e.item.i, 1
0170: 29 0a 20 20 7d 0a 0a 3c 2f 6c 6f 6f 70 2d 6d 61  ).  }..</loop-ma
0180: 6e 69 70 3e 0a                                   nip>.