Ejemplo n.º 1
0
        public static Action AddStateChangeListener <T, S>(this IDataStore <T> self, S mutableObj, Action <S> onChanged, bool triggerInstantToInit = true) where S : IsMutable
        {
            Action newListener = () => {
                if (StateCompare.WasModifiedInLastDispatch(mutableObj))
                {
                    onChanged(mutableObj);
                }
            };

            self.onStateChanged += newListener;
            if (triggerInstantToInit)
            {
                onChanged(mutableObj);
            }
            return(newListener);
        }
Ejemplo n.º 2
0
        public Action AddStateChangeListener <T, S>(S mutableObj, Action <S> onChanged, bool triggerInstantToInit = true) where S : IsMutable
        {
            Action newListener = () => {
                if (StateCompare.WasModifiedInLastDispatch(mutableObj))
                {
                    onChanged(mutableObj);
                }
            };

            innerListeners += newListener;
            if (triggerInstantToInit)
            {
                onChanged(mutableObj);
            }
            return(newListener);
        }
Ejemplo n.º 3
0
 /// <summary> Will be true if the object was modified when the last mutation was
 /// dispatched via the data store the object is managed in </summary>
 public static bool WasModifiedInLastDispatch(this IsMutable self)
 {
     return(StateCompare.WasModifiedInLastDispatch(self));
 }