MRAID-3.0: Resize negative "ready" event listener question
KonstantinTselykh opened this issue · 1 comments
KonstantinTselykh commented
While implementing MRAID-3.0 Resize negative example I encountered next issue:
In readyCheck()
method, when mraid state is loading
- an event listener is added, and startTests
function is passed as parameter. This will cause startTests
to be executed on ready
event without any parameters (they will be undefined
by default). Refer to the below code (from resize-negative-tests.js
):
if (_mraid.getState() === 'loading') {
_mraid.addEventListener('ready', startTests);
} else {
// You can specify done function, timeout (for how long to wait for events), log and error functions
startTests(_mraid, () => {
console.log('[ALL NEGATIVE RESIZE TESTS FINISHED]')
}, 2000, logInfoOnUi, logErrorOnUi);
}
So the questions is:
Was this done intentionally to fail when initial MRAID state is loading
and not ready
?
Or is this a bug, and the if
branch should look something like this:
if (_mraid.getState() === 'loading') {
_mraid.addEventListener('ready', startTests(_mraid, () => {
console.log('[ALL NEGATIVE RESIZE TESTS FINISHED]')
}, 2000, logInfoOnUi, logErrorOnUi));
}