Skip to content

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

Closed
Closed
@nelsonic

Description

@nelsonic

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions