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

Exception when native submodules of Window present #397

Closed
colinmccabe opened this Issue Sep 8, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@colinmccabe
Contributor

colinmccabe commented Sep 8, 2015

When:

  • A submodule of Window (for example, Window.Foo) is used in an app
  • and Window.Foo contains native code (i.e. it has a Native.Window.Foo)
  • and Window itself is used nowhere in the app

an exception occurs in Runtime.js: Uncaught TypeError: Cannot read property 'resizeIfNeeded' of undefined

Here are the relevant lines:

https://github.com/elm-lang/core/blob/2.1.0/src/Native/Runtime.js#L423
https://github.com/elm-lang/core/blob/2.1.0/src/Native/Runtime.js#L434

The problem is that elm.Native.Window is defined because of the presence of the native submodule, but elm.Native.Window.values is undefined because the Window module itself is not used in the app. An exception might occur in either of the two if conditions.

I stumbled upon this while writing a library. Any library (or future version of core) that defines a module under Window might encounter this issue.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 19, 2016

Contributor

Since there is a pull request addressing this issue, I am closing the issue itself.

Contributor

jvoigtlaender commented Jan 19, 2016

Since there is a pull request addressing this issue, I am closing the issue itself.

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