-
Notifications
You must be signed in to change notification settings - Fork 10
How did we get to fastn?
Mark Wylde edited this page Nov 7, 2019
·
8 revisions
const container = document.createElement('div')
const el1 = document.createElement('span')
el1.textContent = 'This is a test'
const el2 = document.createElement('span')
el2.textContent = 'This is another test'
container.appendChild(el1)
container.appendChild(el2)const container = buildElement('div')
const el1 = buildElement('span', { textContent: 'This is a test'})
const el2 = buildElement('span', { textContent: 'This is another test'})
container.appendChild(el1)
container.appendChild(el2)const ui = buildElement('div',
buildElement('span', { textContent: 'This is a test' }),
buildElement('span', { textContent: 'This is another test' })
)const ui = buildElement('div',
buildElement('span', 'This is a test'),
buildElement('span', 'This is another test')
)const colouredEl = buildElement('div', 'I am pretty')
colouredEl.style.backgroundColor = 'yellow'
const ui = buildElement('div',
buildElement('span', 'This is a test'),
buildElement('span', 'This is another test'),
colouredEl
)const ui = buildElement('div',
buildElement('span', 'This is a test'),
buildElement('span', 'This is another test'),
buildElement('div', {
style: {
backgroundColor: 'yellow'
}
}, 'I am pretty')
)const ui = buildElement('div',
buildElement('span', 'This is a test'),
buildElement('span', 'This is another test'),
buildElement('div', {
style: {
backgroundColor: 'yellow'
}
}, 'I am pretty')
.on('click', function() {
this.element.style.backgroundColor = 'blue'
})
)const state = {
backgroundColor: 'yellow'
}
const syncBackgroundColor = new EventEmitter()
const ui = buildElement('div',
buildElement('span', 'This is a test'),
buildElement('span', 'This is another test'),
buildElement('div', {
style: {
backgroundColor: syncBackgroundColor
}
}, 'I am pretty')
.on('click', () => {
state.backgroundColor = 'yellow'
syncBackgroundColor.emit('change', state.backgroundColor)
})
)