Created
March 17, 2017 01:10
-
-
Save SergeyAxenov/57ba1b5d6374113fb6e78d7810ea5112 to your computer and use it in GitHub Desktop.
Zeppelin 0.6.2 Angular. Trying to watch a variable before binding first is not going to work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demonstrates usual z Angular bind/watch/change scenario (watch is working) | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
val logger: Logger = LoggerFactory.getLogger("MyZeppelinLogger"); | |
logger.debug("START"); | |
z.angularUnwatch("ax4_var") | |
z.angularUnbind("ax4_var") | |
logger.debug("Setting ax4_var=Init before watch"); | |
z.angularBind("ax4_var","Init before watch") | |
logger.debug("Before configure watch on ax4_var"); | |
z.angularWatch("ax4_var", (before, after, ctx) => { | |
logger.debug(s"Watch (before, after, ctx) triggered. Old value=$before New value=$after"); | |
}) | |
logger.debug("Watch configured"); | |
logger.debug("Changing ax4_var='Change after watch configured'"); | |
z.angularBind("ax4_var","Change after watch configured") | |
logger.debug("FINISH"); | |
//[DEBUG] 2017-03-17 00:16:27.308 [pool-2-thread-10] MyZeppelinLogger - START | |
//[DEBUG] 2017-03-17 00:16:27.882 [pool-2-thread-10] MyZeppelinLogger - Setting ax4_var=Init before watch | |
//[DEBUG] 2017-03-17 00:16:28.267 [pool-2-thread-10] MyZeppelinLogger - Before configure watch on ax4_var | |
//[DEBUG] 2017-03-17 00:16:28.815 [pool-2-thread-10] MyZeppelinLogger - Watch configured | |
//[DEBUG] 2017-03-17 00:16:29.076 [pool-2-thread-10] MyZeppelinLogger - Changing ax4_var='Change after watch configured' | |
//[DEBUG] 2017-03-17 00:16:29.435 [pool-24-thread-1] MyZeppelinLogger - Watch (before, after, ctx) triggered. Old value=Init before watch New value=Change after watch configured | |
//[DEBUG] 2017-03-17 00:16:29.671 [pool-2-thread-10] MyZeppelinLogger - FINISH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demonstrates an attempt to start watching variable without binding to it first: watch/change scenario (watch does not work) | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
val logger: Logger = LoggerFactory.getLogger("MyZeppelinLogger"); | |
logger.debug("START"); | |
z.angularUnwatch("ax4_var") | |
z.angularUnbind("ax4_var") | |
logger.debug("Before configure watch on ax4_var. No binding on ax4_var set yet"); | |
z.angularWatch("ax4_var", (before, after, ctx) => { | |
logger.debug(s"Watch (before, after, ctx) triggered. Old value=$before New value=$after"); | |
}) | |
logger.debug("Watch configured"); | |
logger.debug("Seting binding on ax4_var='Initializing ax4_var after watch is configured'"); | |
z.angularBind("ax4_var","Init after watch") | |
logger.debug("FINISH"); | |
//[DEBUG] 2017-03-17 00:33:33.424 [pool-2-thread-7] MyZeppelinLogger - START | |
//[DEBUG] 2017-03-17 00:33:34.101 [pool-2-thread-7] MyZeppelinLogger - Before configure watch on ax4_var. No binding on ax4_var set yet | |
//[DEBUG] 2017-03-17 00:33:34.621 [pool-2-thread-7] MyZeppelinLogger - Watch configured | |
//[DEBUG] 2017-03-17 00:33:34.801 [pool-2-thread-7] MyZeppelinLogger - Seting binding on ax4_var='Initializing ax4_var after watch is configured' | |
//[DEBUG] 2017-03-17 00:33:35.219 [pool-2-thread-7] MyZeppelinLogger - FINISH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment