These are chat archives for synrc/n2o

27th
Nov 2016
rusjava8
@rusjava8
Nov 27 2016 08:13
Спасибо :+1:
Roman
@AstRonin
Nov 27 2016 09:16
если есть мысли, что еще хотелось бы видеть, пишите
xiufan
@xiufan
Nov 27 2016 10:18
can i use wf:wire("var ccc='test'"),send browser a javascript varible or function
Andy
@m-2k
Nov 27 2016 13:48
@xiufan what u doing
var ccc - evaluated in local scope
; missing
also u can use target as{qs,SelectorString}
xiufan
@xiufan
Nov 27 2016 14:11
I just want to pass a value to some other javascript
the value get from kvs
Andy
@m-2k
Nov 27 2016 14:13
how are you going to use this value later if you it is declared in the local scope?
xiufan
@xiufan
Nov 27 2016 14:16
i try not use var , it do not work
wf:wire("ccc = 'test'")
Andy
@m-2k
Nov 27 2016 14:17
; missing
xiufan
@xiufan
Nov 27 2016 14:18
about this {qs,SelectorString} , please give me more detail
Andy
@m-2k
Nov 27 2016 14:19
{qs,"span.class1"} == document.querySelector("span.class1")
xiufan
@xiufan
Nov 27 2016 14:21
thank you. I can use some hide element to pass the value to Ueditor javacript .
xiufan
@xiufan
Nov 27 2016 14:23
n2o document say wf:wire direct way do wf:wire("alert('hello')", so i want to know function or var can pass
Andy
@m-2k
Nov 27 2016 14:24
alert - is function
xiufan
@xiufan
Nov 27 2016 14:24
yes , i find the method
what about mine function?
Andy
@m-2k
Nov 27 2016 14:25
give me u'r broken part of erlang code
xiufan
@xiufan
Nov 27 2016 14:25
wf:wire("function tt(){ do some thing}")
Andy
@m-2k
Nov 27 2016 14:26
and?
how use it?
in JS
xiufan
@xiufan
Nov 27 2016 14:27
i want to know that
how do use that
Andy
@m-2k
Nov 27 2016 14:27
wf wire DO NOT generate a javascript code, it EXECUTES code
wf:wire("yourFunction = function (){ return 'do some thing' } ; ") - this way for init fun
yourFunction(); - calling
xiufan
@xiufan
Nov 27 2016 14:30
let me try this way.thank you
Andy
@m-2k
Nov 27 2016 14:30
see ya
Andy
@m-2k
Nov 27 2016 14:48
@xiufan
event(init) ->
    wf:wire(["qi('btn_start').innerText = '",<<"Старт"/utf8>>,"';"]),
    wf:wire(<<"qi('btn_stop').innerText = 'Стоп';"/utf8>>),
    [];
xiufan
@xiufan
Nov 27 2016 14:54
@m-2k wf:wire("tt = function() {console.log('test111');};"),
wf:wire(" ttt= 'mine';"),
it work
the browser javascript code need some load time
xiufan
@xiufan
Nov 27 2016 15:03
setTimeout("tt()",1000);
setTimeout("alert(ttt)",1000);
Andy
@m-2k
Nov 27 2016 15:04
timeout not needed

again

wf wire DO NOT generate a javascript code, it EXECUTES code

for eventing in JS use binding and sending events
if needed
xiufan
@xiufan
Nov 27 2016 15:08
i put the code in event(init), if not set timeout ,report the error tt() not defined
Andy
@m-2k
Nov 27 2016 15:09
YEP
why should it work differently?
xiufan
@xiufan
Nov 27 2016 15:10
i think the browser need time ?
Andy
@m-2k
Nov 27 2016 15:11
Why have you set variables and you catch it through a timeout? if this test is yes, if the application logic, you're doing something wrong
you write meaningless code, and you want me to do so to make it work
what the fuh
xiufan
@xiufan
Nov 27 2016 15:15
I use Baidu ueditor editorial content, assign it to the need to call setContent()
i get the content from the kvs , so i want to use wf:wire() pass the value
i do not know the right way in n2o to deal with the situation
Andy
@m-2k
Nov 27 2016 15:19
just write wf:wire("baiduMegaCoolEditor.setContent(content from DB);"),
JUST SIMPLE
YAY! awesome!
xiufan
@xiufan
Nov 27 2016 15:21
thank you ,i make a wrong way
Andy
@m-2k
Nov 27 2016 15:21
read anything about JS threading model, please
it's not a server-side problem
xiufan
@xiufan
Nov 27 2016 15:23
ok, i will do this.