lukebayes/nomplate

Global state should be configurable

Closed this issue · 2 comments

Currently, builder.js checks the global environment at module load time to find an implementation of requestAnimationFrame and it defaults to setTimeout if one is not found. This allows everything to work in the browser and mocha, but isn't appropriate.

Tests and alternative runtime environments should be able to configure and/or clear any module-global state in order to avoid dependencies on load-ordering.

Introducing a global config method on the nomplate library. This method will accept an object with keys on it and will merge provided values what whatever hash already exists, overwriting existing keys with only those that were provided.

The currently expected keys will be requestAnimationFrame and setTimeout (used by builder.js and render_element.js).

Fixed in PR #64