Closed mattpap closed 11 years ago
I'm wondering about the solution --- now how would you model a javascript module? E,g, you want to output SomeModule.someMethod();
True you couldn't do that until now since it included the package. But stripping just the package seems to make more sense in a way.
@nau any thoughts on my comment?
Agree, I'll rethink the solution, thank you :)
Would it be possible to extends some marker superclass or trait?
object L extends JsInterface {
def alert(x: Any) : Unit = ???
}
object LAjax extends JsInterface("liftAjax") {
def makeAjaxCall(str: String) : String = ???
}
javascript {
L.alert("hello") // alert("hello")
LAjax.makeAjaxCall("test") // liftAjax.makeAjaxCall("test")
}
@nafg's problem can be solved this way:
object GlobalObject {
object SomeModule {
def someMethod() {}
}
}
...
import GlobalObject._
One can just put all APIs in
package org.jscala { ... }
to temporarily fix this issue.This can be showed in repl:
Note that repl strips its internal wrappers when printing results, so:
but you can
println
to show full prefix.