You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
I have objects for keeping model data. I call them domain objects. They are instances of classes corresponding to model entities. Like you know Department, Employee, User and so on. These objects have nothing to do with the UI layer. But they can be used as a model for UI components.
Let's imagine we have a Glimmer component (e.g. "Editor") that should provide UI for editing some domain object (e.g. User).
These objects already have a mechanism for dirty tracking. For every entity property in model there's a function like prop() that can be used as set/get accessor and on property value change there're events on object ("change" and "change:prop"). I guess it's similar to old Ember.
So now I'm thinking can I use these objects with Glimmer and how.
Can I integrate my dirty tracking with Glimmer? And how could it be approached?
The text was updated successfully, but these errors were encountered:
thank you! it's a clever approach, but not quite that I thought about. In this approach I'll have to use a method on a component to modify its model. I'd prefer to have dirty tracking w/o additional level of indirection: oninput={{action user.firstName}}
It's not about just syntax, imagine some business logic that modifies objects, it'd be cumbersome to manually call a special method on a component that owns object graph to notify engine.
Ideally I'd like to be able to notify Glimmer from objects' internals in some way that compatible with @track aspect...
take a look at second example, on render time you may pass component rerender-trigger-fn to your model, and this model can invoke callback to trigger rerender.
as benifit - you always know is your model usied inside any component or not
but, you neet to be careful about proper component destroying and unmounting
Hi
I have objects for keeping model data. I call them domain objects. They are instances of classes corresponding to model entities. Like you know Department, Employee, User and so on. These objects have nothing to do with the UI layer. But they can be used as a model for UI components.
Let's imagine we have a Glimmer component (e.g. "Editor") that should provide UI for editing some domain object (e.g. User).
These objects already have a mechanism for dirty tracking. For every entity property in model there's a function like
prop()
that can be used as set/get accessor and on property value change there're events on object ("change" and "change:prop"). I guess it's similar to old Ember.So now I'm thinking can I use these objects with Glimmer and how.
Can I integrate my dirty tracking with Glimmer? And how could it be approached?
The text was updated successfully, but these errors were encountered: