Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we *need* to "init"? #49

Closed
nelsonic opened this issue Jul 30, 2018 · 2 comments
Closed

Do we *need* to "init"? #49

nelsonic opened this issue Jul 30, 2018 · 2 comments

Comments

@nelsonic
Copy link
Member

While re-reading the code (and preparing for "elmish") It occurred to me that we might be over-complicating things ...

Do we need an init function to initialise the DOM in:

function init(doc){
document = doc; // this is used for instantiating JSDOM. ignore!
}
/* The code block below ONLY Applies to tests run using Node.js */
/* istanbul ignore next */
if (typeof module !== 'undefined' && module.exports) {
module.exports = {
view: view,
mount: mount,
update: update,
div: div,
button: button,
empty: empty,
init: init
}
} else { init(document); }

e.g:
init(document); // pass the JSDOM into counter.js

If we use https://github.com/rstacruz/jsdom-global in our tests, we should not need an init function.
I'm going to experiment with updating the counter-reset tests and see if I can remove the init function completely.

@nelsonic
Copy link
Member Author

Testing this now so I can simplify #44

@nelsonic
Copy link
Member Author

Removed it. simplified code. stoked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant