File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 " Goede" ,
44 " Protos" ,
55 " asynchronicity" ,
6+ " behaviour" ,
67 " campbells" ,
78 " firstname" ,
89 " instanceof" ,
Original file line number Diff line number Diff line change 33{
44 class Observer {
55 constructor ( subject ) {
6- subject . register ( this ) ;
6+ subject . subscribe ( this ) ;
77 }
88 }
99
Original file line number Diff line number Diff line change 66 this . observers = new Set ( ) ;
77 }
88
9- register ( observer = { } ) {
9+ subscribe ( observer = { } ) {
1010 if ( ! ( typeof observer . update === 'function' ) ) {
1111 throw new Error ( `Observer must implement an 'update' method.` ) ;
1212 }
Original file line number Diff line number Diff line change 22
33{
44 function Observer ( subject ) {
5- subject . register ( this ) ;
5+ subject . subscribe ( this ) ;
66 }
77
88 window . Observer = Observer ;
Original file line number Diff line number Diff line change 55 this . observers = new Set ( ) ;
66 }
77
8- Subject . prototype . register = function ( observer = { } ) {
8+ Subject . prototype . subscribe = function ( observer = { } ) {
99 if ( ! ( typeof observer . update === 'function' ) ) {
1010 throw new Error ( `Observer must implement an 'update' method.` ) ;
1111 }
Original file line number Diff line number Diff line change 1414 } ;
1515 }
1616
17- register ( view ) {
17+ subscribe ( view ) {
1818 this . views . push ( view ) ;
1919 }
2020
Original file line number Diff line number Diff line change 55{
66 class View {
77 constructor ( model ) {
8- model . register ( this ) ;
8+ model . subscribe ( this ) ;
99 this . root = document . getElementById ( 'root' ) ;
1010 model . fetchData ( ) ;
1111 }
You can’t perform that action at this time.
0 commit comments