montagejs/frb — pull request #20 by asolove (2013-09-25 16:10:52+00:00)
Title: Remove need for once()

**tl;dr; [autoCancelPrevious should not allow its observer to be replaced after it is cancelled](#L2R1406).** There is a problem upstream with the propertyObserver that allows this to happen, which I can't diagnose. We may want to hold off this merge and fix there.

I spent some time tracing down sources of multiple calls of functions passed to once(). I discovered that all of the ones caused by the current test suite boil down to replacing parent objects that have property observers on them.

```
var test = Bindings.defineBindings({
a: []
}, {
"b": {"<-": "a.0"}
}
test.a[0] = 2; // no problem
test.a = [] // kaboom!
```

The property change observer on ".0" has its cancel callback called, and then later in the same call-stack its replace callback is called. Disallowing this in autoCancelPrevious removed all cases of functions passed to once being called more than once.