Somewhere in a parallel universe...

JavaScript and a Computer talking

...

Imagine the Computer has a squeaky voice

  • Computer: Lovely JavaScript, is that you???
  • JavaScript: Yes, that's me!!!
  • C: But JS, why you lovely?
  • JS: Because I am simple, I am beautiful
  • C: I don't understand beautiful, define beautiful..
  • JS: I use functions and objects - only
  • C: But hooooow?!
  • JS: I un-use classes, news, popular OOP and a bulk of design patterns you may have heard of
  • C: But Whyyyyyy?
  • JS: Because I am flexible, functional, even sexy!
  • C: But ...
  • JS: ...I discard complexity! Because I need NO classes, directives, cohorts of patterns.....
  • JS: ...(I discard) a myriad of NEW concepts for the dev to get going with a simple calculator app in the browser
  • JS: I only need... a little something...
  • C: But whaaat?!
  • JS: This little something adds to my natural superpowers! I remain simple... to build anything.. sanely... - it's called obs-disp! It handles the communication between my objects.
  • C: But hoOooOOw ??!
  • JS: Like this: write your plain old functions in plain old me (JavaScript), make them return a single object - this object has arbitrary keys - events. The values are functions to handle these events! Aaand a single call can trigger them - from anywhere! No prior event definition required! Though possible, TypeScript included!
  • C: WOOOOW
  • JS: Aaand the main point is JUST this - create functions (scope), manage this scope only downwards and... dispatch events - the functions will now react to those events! [eventName]: () => { ...event trggered... }
  • C: Surely..
  • JS: .. That's ALL!
  • C: Surely this cannot be real!
  • JS: It is real. And don't call me Surely!
  • JS: My name is Script... JavaScript.

:: { PEWWWPEWWPEWW } ERROR ERROR ERROR <the given universe explodes, err msg: AWESOMENESS spiked to level 9k^22> ERROR ERROR ERROR

.

Conclusion?

Try obs-disp