cherifGsoul on upgrade-docs-html-canjs
cherifGsoul on master
Upgrade the site theme for new … (compare)
cherifGsoul on upgrade-docs-html-canjs
Upgrade the site theme for new … (compare)
can-observation.js:255 Uncaught TypeError: Cannot read property 'valueDependencies' of undefined
at Function.Observation.updateChildrenAndSelf (can-observation.js:255)
at eval (can-observation.js:257)
at Set.forEach (<anonymous>)
at Function.Observation.updateChildrenAndSelf (can-observation.js:256)
at Observation.get (can-observation.js:156)
at Object.getValue (get-set.js:147)
at Text.branchRenderer (mustache_core.js:329)
at Text.HTMLSection.targetCallback (html_section.js:151)
at hydrateCallbacks (can-view-target.js:254)
at Object.hydrate (can-view-target.js:276)
hey, I am using can-fixture and I was wondering how to avoid getting stringified responses. for example:
let statuses = {
success: 1,
statuses: "anything really, just testing!"
}
fixture({method: "get", url: "/json/internet/blah/blah/blah"}, function() {
return statuses
});
returns statuses as a string
Can someone explain visible difference between can observables and stream functionality ? LIke Kefir streams / toStream etc. What is possible with streams that isn't possible with observables ?
For example here: https://canjs.com/doc/guides/technical.html in section where redux-like approach described. There is point:Having a single, ApplicationViewModel that contains all state, derived using can-define-stream from events dispatched on the ApplicationViewModel.
I cant understand why we need can-define-stream here ? Any observable will have change
event as well.
value
stream added. But you could have same functionality in set
before, isn't it ?
set
and with value
it may be different, but still
value
behavior is a lot simpler and solves most of the same problems
<form>
<input class="x"> + <input class="y"> = <span class="result"></span>
</form>
Using most.js to make it reactive:import { fromEvent, combine } from 'most'
const xInput = document.querySelector('input.x')
const yInput = document.querySelector('input.y')
const resultNode = document.querySelector('.result')
const add = (x, y) => x + y
const toNumber = e => Number(e.target.value)
const renderResult = result => {
resultNode.textContent = result
}
export const main = () => {
// x represents the current value of xInput
const x = fromEvent('input', xInput).map(toNumber)
// y represents the current value of yInput
const y = fromEvent('input', yInput).map(toNumber)
// result is the live current value of adding x and y
const result = combine(add, x, y)
// Observe the result value by rendering it to the resultNode
result.observe(renderResult)
}