A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/58206168/binding-scala-vars-bind-seems-to-not-work-correctly below:

Binding.scala: Vars.bind seems to not work correctly

Calling .bind on a Vars in a watched Binding definition leads to strange behavior. The new binding is updated only once at init time but not after updating the Vars content.

For example, if I do this:

private val test: Vars[Int] = Vars(1,2,3,4)
Binding(test.bind match{case newd => println("TESTS DATAS has changed: " + newd)}).watch
test.value.append(1111)

Then, I got a single output line (while I should get two):

TESTS DATAS has changed: Buffer(1, 2, 3, 4)

See this scalafiddle for a complete working example: https://scalafiddle.io/sf/0PkkLPE/1

I tried different options like transforming to a Binding first with .all but that does not change anything. Maybe, I did not understand something with Vars but that doesn't look very consistent with Varfor which it works well.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4