{"id":3316,"date":"2023-02-27T16:35:59","date_gmt":"2023-02-27T21:35:59","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=3316"},"modified":"2023-02-27T16:35:59","modified_gmt":"2023-02-27T21:35:59","slug":"why-is-javascript-event-driven-2","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/02\/27\/why-is-javascript-event-driven-2\/","title":{"rendered":"Why is JavaScript event-driven?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3317\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/download-5-300x157.png\" alt=\"\" width=\"300\" height=\"157\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/download-5-300x157.png 300w, https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/download-5.png 310w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>\u00a0<strong>Why is JavaScript event-driven?<\/strong><\/p>\n<p>First, it is useful to gain an understanding of what &#8220;event-driven&#8221; means. In event-driven architecture, the program builds off a pattern known as publish-subscribe or observer. In this pattern, there is a &#8220;subject&#8221; who broadcasts a message to at least one &#8220;observer.&#8221; The way that this applies to JavaScript is that JavaScript in your browser interacts with HTML elements, where the\u00a0 HTML takes on the role of subject, and JavaScript functions taking on the role of the observer. However, it is not every JavaScript function that is the &#8220;listener&#8221; to the HTML &#8220;event emitter.&#8221; JavaScript functions have to be registered as a listener with <strong>.addEventListener<\/strong>. This capability to interact makes JavaScript event-driven.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0Why is JavaScript event-driven? First, it is useful to gain an understanding of what &#8220;event-driven&#8221; means. In event-driven architecture, the program builds off a pattern known as publish-subscribe or observer. In this pattern, there is a &#8220;subject&#8221; who broadcasts a message to at least one &#8220;observer.&#8221; The way that this applies to JavaScript is that [&hellip;]<\/p>\n","protected":false},"author":29393,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[663943],"tags":[],"class_list":{"0":"post-3316","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-instructor","7":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/users\/29393"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=3316"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3316\/revisions"}],"predecessor-version":[{"id":3318,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3316\/revisions\/3318"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=3316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=3316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=3316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}