Bad Compile Target
```javascript!
/**
* let/count=0
* const/doubleCount=count*2
* if=Math.random() > 0.5
* button onClick(){count++}
* -- Value: ${count}, Double: ${doubleCount}
* effect() {
* console.log(count);
* }
*/
const $ = section("index.marko");
const $if_then = section("index.marko$if_then");
const $count = signal($, "count", () => [$doubleCount, $onClick, $effect]);
const $setup_count = setupSignal($count, () => 0);
const $doubleCount = compute($, "doubleCount", ({ count }) => count * 2);
const $if_test = () => Math.random() > 0.5; // can also be a compute.
const $onClick = on($if_then, "btn", "click", ({ count }, s) => () => {
$count(s, count + 1);
});
const $effect = effect($, ({ count }) => {
console.log(count);
});
const $fooAttr = attr($if_then, "btn:foo:count");
const $barAttr = attr($if_then, "btn", "bar", () => $count);
const $if = condition(
$if_test,
template(
$if_then,
$onClick,
el("button", {
id: "btn",
attrs: [
"class=hello",
$fooAttr,
attr("bar", $count)
],
children: [
"Value: ",
text($count),
"Double: ",
text($doubleCount),
]
})
),
);
// default export
const t = template($, $setup_count, $if);
// STUB RUNTIME.
/*@__NO_SIDE_EFFECTS__*/
function section(id) {
return { id };
}
/*@__NO_SIDE_EFFECTS__*/
function template(section, ...parts) {
return {
section,
parts,
};
}
/*@__NO_SIDE_EFFECTS__*/
function condition(signal, consequent, alternate) {
return {
signal,
consequent,
alternate,
};
}
/*@__NO_SIDE_EFFECTS__*/
function text(section, name) {
return { section, name };
}
/*@__NO_SIDE_EFFECTS__*/
function el(name) {
return { name };
}
/*@__NO_SIDE_EFFECTS__*/
function signal(section, name, subscribers) {
return {
section,
name,
subscribers,
};
}
/*@__NO_SIDE_EFFECTS__*/
function setupSignal(signal, initialValue) {
return {
signal,
initialValue,
};
}
/*@__NO_SIDE_EFFECTS__*/
function compute(section, name, fn, subscribers) {
return {
section,
name,
fn,
subscribers,
};
}
function on(section, el, event, signals, fn) {
console.log("NOT PURE");
return {
section,
el,
event,
signals,
fn,
};
}
function effect(signals, fn) {
console.log("NOT PURE");
return {
signals,
fn,
};
}
```