neighbour-hoods / nh-launcher

Creating a group coherence with holochain apps
Other
4 stars 3 forks source link

Create input/output widget delegate creation code #111

Closed adaburrows closed 8 months ago

adaburrows commented 1 year ago

Create helpers to create the delegates needed for updating and fetching and assessments along specific dimensions:

/**
 * The minimal interface needed for an assessment widget
 */
export interface InputAssessmentWidgetDelegate {
  getLatestAssessmentForUser(): Assessment // get the latest assessment value the user created (or none if never assessed or invalidated)
  subscribe(_:CallbackFn): UnsubscribeFn // subscribe to when the current assessment changes
  createAssessment(assessment: Assessment): Assessment // create an assessment
  invalidateLastAssessment(): void // invalidate the last created assessment [ignore for now, we only support creating new assessments]
}

/**
 * The minimal interface needed to render computed assessments
 */
export interface OutputAssessmentWidgetDelegate {
  getLatestAssessment(): Assessment // get the latest computed assessment value (regardless of user, for computed dimensions)
  subscribe(_:CallbackFn): UnsubscribeFn // subscribe to when the current computed dimension changes
}

Do we have a method for fetching the latest assessment for a given user?