예제 #1
0
 /// <summary>
 ///     A stream that is guaranteed to fire once upon listening, giving the current
 ///     value of a cell, and thereafter gives the updates/steps for the cell.
 /// </summary>
 /// <typeparam name="T">The type of the values in the cell.</typeparam>
 /// <param name="c"></param>
 /// <returns></returns>
 /// <remarks>
 ///     This is an OPERATIONAL primitive, which is not part of the main Sodium
 ///     API.  It breaks the property of non-detectability of cell steps/updates.
 ///     The rule with this primitive is that you should only use it in functions
 ///     that do not allow the caller to detect the cell updates.
 /// </remarks>
 public static Stream <T> Value <T>(Cell <T> c) => Transaction.Apply(c.Value, false);
예제 #2
0
 /// <summary>
 ///     A stream that gives the updates/steps for a cell.
 /// </summary>
 /// <typeparam name="T">The type of the values in the cell.</typeparam>
 /// <param name="c"></param>
 /// <returns></returns>
 /// <remarks>
 ///     This is an OPERATIONAL primitive, which is not part of the main Sodium
 ///     API.  It breaks the property of non-detectability of cell steps/updates.
 ///     The rule with this primitive is that you should only use it in functions
 ///     that do not allow the caller to detect the cell updates.
 /// </remarks>
 public static Stream <T> Updates <T>(Cell <T> c) => Transaction.Apply(trans => c.Updates(trans).Coalesce(trans, (left, right) => right), false);