Kræn Hansen

Results 317 comments of Kræn Hansen

I wonder what an intuitive API would look like. We cannot overload the `++` or `+=` operators (because that's a limit in JS), and as I see it we have...

> One way would be to define a new data type and have that wrap "int". Or we would add an option to the property object. I agree - it...

As I hinted in my first comment, we don't have ways to explicitly intercept increments and decrements (`++`, `--`, `+=` and `-=`) except through a setter, which would also be...

@nirinchev that's a cool approach and a great use of the `valueOf` method - the only drawback I can think of is that `typeof obj.myCounter` would be `"object"` and not...

> not something we want/can support We could probably support it, via [the heuristic I outlined above](https://github.com/realm/realm-js/issues/4089#issuecomment-2049418592) - if we want to is a different question. I do see some...

> I don't believe it's possible in JS, but in languages where ++ is overloadable, it'd be bad practice to implement it in a way where it mutates the object...

I've updated the description above with my takeaway of the discussions above ☝️

Rebased on latest `main`

The changes to BaaS [got reverted](https://github.com/10gen/baas/pull/12848) and I don't have an immediate need for this feature at the moment. I'll just leave this as a draft for now.

> I think this is bad as it is not good to handle error on component renders I would expect developers to use an error boundary to handle these errors:...