Replies: 1 comment 1 reply
-
Good question. They should probably be field of a Browser, with initial values set probably in the constructor, in a "production" implementation. One of the constraints we've adopted for the book is to keep things as simple as possible and try to never do something that seems odd in one chapter to make exercises or later chapters easier. The width and height are constants in the book's browser, so we kept them global constants, but you're right that once you have resizing it's much more natural to keep them inside a Browser. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For those following along and testing against the chapter tests, the WIDTH/HEIGHT values in main scope instead of inside the Browser don't feel very natural, particularly in the Browser.resize callback implementation. I'm currently trying to get the resize tests to pass with the top-level WIDTH/HEIGHT variables being modified directly in the tests, but am wondering if there is a reason these aren't Browser fields/suggesting a bit of rationale in the chapter and/or tests for those who are following along with the testing code.
Beta Was this translation helpful? Give feedback.
All reactions