n
n
nexo
Search…
n
n
nexo
Introduction
Components
DOM Tools
DOM Event handler
Event system
Web Tools
Data Models
Project demo
Powered By
GitBook
Event system
n.on(event, function);
Comunicate any component in anyone direction
1
n
.
ready
(()
=>
{
2
3
n
.
render
(
'eventTest'
,
'main'
)
4
5
n
.
on
(
'sayHi'
,
name
=>
{
6
console
.
log
(
`
Hi
${
name
}
!
`
)
7
})
8
9
})
Copied!
Emit with component click:
1
n
.
set
({
2
name
:
'eventTest'
,
3
html
:
n
=>
`
4
NAME: <input type="text" id="name">
5
<div id="sendEvent">CLICK FOR SEND NAME IN EVENT</div>
6
`
,
7
ready
:
n
=>
{
8
n
.
on
(
'#sendEvent'
,
'click'
,
()
=>
{
9
n
.
emit
(
'sayHi'
,
n
.
id
(
'name'
).
value
)
10
})
11
}
12
})
Copied!
Previous
DOM Event handler
Next
Web Tools
Last modified
1yr ago
Copy link
Contents
n.on(event, function);
Emit with component click: