mergify[bot] on master
Update scalajs-dom to 2.2.0 (#6… (compare)
fdietze on scala3
Improve workaround comment (compare)
fdietze on scala3
Move UndefinedModifier into low… Almost fix the last compile err… (compare)
cornerman on scala3
potential fix (compare)
fdietze on scala3
Scala 3 (compare)
fdietze on explicit-dependencies
Add sbt-explicit-dependencies p… (compare)
cornerman on scala3
fix compile errors (compare)
dependencyTree
tells me it is colibri that colibri that imports it.... (nice tool)
onInput
the focus on element input is loss more or less, because the element is showing is focused but the cursor is loss.Observer
connecting on this element so I don't quite get the solution. val onChangingValueTxt =
SyncIO(
onInput
.value
.transformLifted( (e: Observable[String]) =>
e
.distinctUntilChanged
.withLatestFrom(hdlFieldActive){ case (txt: String, (field: String, currentValue: JsonValue)) =>
val currentValue2: JsonValue = Try {
wrapValue(txt, currentValue)
} match {
case Success(value) => value
case Failure(exception) => JsonNull
}
(field, currentValue2)
}
) --> hdlChangingValue
)
val mountCellFocusSelectContent = Observer.create[(dom.Element, String, String)] { case (elem, inputType, idTxt) =>
if (idTxt == elem.id) {
val txt = if ( inputType == "input" ) elem.asInstanceOf[html.Input] else elem.asInstanceOf[html.TextArea]
Try {
val range = dom.document.createRange
val sel = scalajs.dom.window.getSelection
sel.removeAllRanges
range.selectNodeContents(txt)
sel.addRange(range)
} match {
case Success(value) =>
txt.focus
case Failure(exception) => alert("Hubo un error al convertir el valor del componente: line:102 from Grid3 " + exception.getMessage())
}
}
}
$('#Search').focus(function() {
setTimeout((function(el) {
var strLength = el.value.length;
return function() {
if(el.setSelectionRange !== undefined) {
el.setSelectionRange(strLength, strLength);
} else {
$(el).val(el.value);
}
}}(this)), 0);
});
well I did this:
val mountCellFocusSelectContent = Observer.create[(dom.Element, String, String)] { case (elem, inputType, idTxt) =>
if (idTxt == elem.id) {
val txt = if ( inputType == "input" ) elem.asInstanceOf[html.Input] else elem.asInstanceOf[html.TextArea]
Try {
if (window.navigator.userAgent.indexOf("Chrome") == -1 || window.navigator.userAgent.indexOf("Safari") == -1) {
val range = dom.document.createRange
val sel = scalajs.dom.window.getSelection
sel.removeAllRanges
range.selectNodeContents(txt)
sel.addRange(range)
}
} match {
case Success(value) =>
txt.focus
case Failure(exception) => alert("Hubo un error al convertir el valor del componente: line:102 from Grid3 " + exception.getMessage())
}
}
}
althought I don't know if is right. :-)
Observable
means, we need to handle a subscriptions: adding callbacks onMount and onDismount. Operating on an Observer
, is great because you can just push things into an Observer
without state. So, it is kind of a performance optimization to prefer Observer operations.
Source
, Sink
generally, because I felt, it would be too intrusive, when just working with Monix or scalarx or airstream natively. Maybe, just hide them under a syntax._
-import? It is nicer too write. And that is an advantage of the Sink
, Source
archtiecture.
Observable
/Observer
there?
Source
and Sink
would feel wrong because usually algebraic methods are members these days. I hope that's going to change with scala 3 and the extension
keyword. No more .map
on everything. Just a single global extension method for all functor instances.
a.withLatest(b)
and the method on the static object Observable.withLatest(a, b)
. While I think its fine to have both, outwatch tends to use them at random in some places and I believe it would make the code more readable to make that a little more consistent.
not found: type Handler
[error] def cmpDate(hdl: Handler[Long]) =
import outwatch.reactive.handler.Handler
import outwatch.reactive.handlers.monix._
Handler
. To me, this concept feels too complex, that you indirectly create new instances of your stream-types (just with the help of a magic import). It just seems more straightforward to directly create your subjects with the library of your choice. The intent is much more clear.Observable
in your dom nodes.any idea why this code works perfectly, but if I put the class FrmClass
on another file it doesn't?
class TestingOnClassSpec extends JSDomAsyncSpec {
class FrmClass {
val testClick = new Observer[String] {
def onNext(elem: String): Future[Ack] = {
Future {
println(elem)
Continue
}
}
def onError(ex: Throwable): Unit = { println(ex.printStackTrace.toString) }
def onComplete(): Unit = println("O completed Handler")
}
val but = button( idAttr := "cmdTestOnClass", "Save", cls := "myButton",
onClick.use("on the observer a class ----------") --> testClick
)
}
it should "be test the save button" taggedAs(ButtonTestingTest) in {
val frm = new FrmClass
for {
_ <- OutWatch.renderInto[IO]("#app", frm.but)
} yield {
val element = document.getElementById("cmdTestOnClass")
sendEvent(element, "click")
succeed
}
}
}
something lacking me ?