Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jake Read
rndmc
Commits
1d01f0c1
Commit
1d01f0c1
authored
Nov 26, 2018
by
Jake Read
Browse files
comments
parent
096c9730
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/ui/uiButton.js
View file @
1d01f0c1
(
function
(){
// client-side button object
/* KRITICAL STEP */
// this is our object, that we will later append
// to the .lump position
var
btn
=
{}
//
make the dom object
//
our dom element
var
li
=
document
.
createElement
(
'
li
'
)
li
.
innerHTML
=
'
button test
'
li
.
addEventListener
(
'
click
'
,
function
(
evt
){
...
...
@@ -15,9 +17,17 @@
socketSend
(
'
put ui change
'
,
data
)
})
/* KRITICAL STEP */
// we have to give our 'lump' object a .domElem, this
// will be referenced upstream to append to the right module
// append it to the dom so that it can be appended on init
btn
.
domElem
=
li
/* KRITICAL STEP */
// whatever is posted to .lump will receive messages through
// .onMessage, so if we don't write one, we'll cause errors
// upstream, and besides, wouldn't be able to get anything from
// the server
btn
.
onMessage
=
function
(
msg
){
console
.
log
(
'
got message in client side ui object
'
,
msg
)
if
(
msg
.
call
==
'
setText
'
){
...
...
@@ -25,8 +35,10 @@
}
}
/* KRITICAL STEP */
// expect this to only be used once
// it's basically our init function
// and gets called once the module is loaded
window
.
registerNewModule
=
function
(
id
,
key
){
btn
.
parentId
=
id
btn
.
key
=
key
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment