Closed m-mujica closed 5 years ago
maybe related:
import { ObservableArray, ObservableObject } from "//unpkg.com/can@6/core.mjs";
class MyObs extends ObservableObject {
static props = {
breakpoints: {
get default() {
return new ObservableArray();
}
},
newBreakpointKey: {
default: "",
value({ listenTo, resolve, lastSet }) {
resolve(lastSet.get());
listenTo(lastSet, resolve);
listenTo("breakpoints", () => {
resolve("");
});
}
}
};
const obj = new MyObs();
obj.on("newBreakpointKey", () => {});
obj.breakpoints = [ "todos.length" ];
assert.equal(vm.newBreakpointKey, ""); // FAILS
@phillipskevin any pointers regarding where to start looking? Where should the event be triggered?
seems this might be a good start https://github.com/canjs/can-observable-array/blob/cee10e6856606a5b9121b625162e1e3f2c00d423/src/proxy-array.js#L197
I found this issue working on StacheElement components... I had to call .initialize
otherwise the events are not fired for performance reasons. (Note: .render
also works)