scalawarrior / scalajs-ace

Ace facade types for Scala.js
Apache License 2.0
21 stars 8 forks source link

TypeError #13

Open Tamriel opened 7 years ago

Tamriel commented 7 years ago

I get

TypeError: $m_Lcom_scalawarrior_scalajs_ace_package$(...).ace__Lcom_scalawarrior_scalajs_ace_Ace(...) is undefined

when using your example code

import com.scalawarrior.scalajs.ace._

val editor = ace.edit("editor")
Tamriel commented 7 years ago

When I click on the error the browser shows the full Javascript line: $m_Lcom_scalawarrior_scalajs_ace_package$().ace__Lcom_scalawarrior_scalajs_ace_Ace().edit("editor"). I forked the official Scala.js tutorial and added ace. Just clone and have a look yourself (at the branch 'ace'). It would be really great if you take a look! :-)

facundoq commented 7 years ago

@Tamriel Your problem is that you haven't included the JS code. Add, say:

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js"></script>

to your HTML and the code will work. Make sure you give the containing element a size before calling ace.edit