| 1 | // crisp_lettuce.js -- async, but make it crunchy. |
| 2 | // |
| 3 | // Loads tensed-late on the bread, runs after the acid layer, and NEVER |
| 4 | // wilts while the constructor is running. This is hearts-of-Romaine, |
| 5 | // the crunchy core. It was rinsed in cold water and spun until dry, and |
| 6 | // it is going to stay that way for the entire session. |
| 7 | // |
| 8 | // TODO(you'll-burn-it): do not grill me. do not put hot things on me. |
| 9 | |
| 10 | export const lettuce = { |
| 11 | batch: 'hearts', // the crunchy core, no outer flirt leaves |
| 12 | ready: true, // freshly rinsed and spun; dry is critical |
| 13 | |
| 14 | async layerOn(hoagie, position = 'under the dressing') { |
| 15 | await rinse(); // cold water, then SPIN |
| 16 | return hoagie.add({ |
| 17 | crisp: 11, // 11/10, because 10 is what the sauce gets |
| 18 | position, // positional, like the real thing |
| 19 | }); |
| 20 | }, |
| 21 | |
| 22 | crunch(stress) { |
| 23 | // blocks the event loop on purpose. crunch is synchronous I/O |
| 24 | // and pretending otherwise would make this a soggy lettuce. |
| 25 | return stress ? 'CRUNCH' : 'crunch'; |
| 26 | }, |
| 27 | }; |