当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fluxx.LocalStore函数代码示例

本文整理汇总了TypeScript中fluxx.LocalStore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript LocalStore函数的具体用法?TypeScript LocalStore怎么用?TypeScript LocalStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LocalStore函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: LocalStore

export const loginStore = () => LocalStore(initialState, on => {
  on(actions.updateEmail, (state, value) => {
    return Object.assign({}, state, {
      email: updateFieldValidation(state.email, value, validateEmail(value))
    })
  })

  on(actions.updatePassword, (state, value) => {
    return Object.assign({}, state, {
      password: updateFieldValidation(state.password, value, validatePassword(value))
    })
  })

  on(actions.updateErrors, (state, value) => {
    return Object.assign({}, state, {errors: value})
  })

  on(actions.closeErrors, (state) => {
    return Object.assign({}, state, {errors: null})
  })

  on(actions.success, (state) => {
    return Object.assign({}, state, {step: "success"})
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:25,代码来源:loginStore.ts

示例2: LocalStore

export const resetPasswordStore = () => LocalStore(initialState, on => {
  on(actions.updatePassword, (state, value) => {
    return Object.assign({}, state, {
      password: updateFieldValidation(state.password, value, validatePassword(value)),
      password2: updateUnchangedFieldValidation(state.password2, state.password2.value, validatePassword2(value, state.password2.value))
    })
  })

  on(actions.updatePassword2, (state, value) => {
    return Object.assign({}, state, {
      password2: updateFieldValidation(state.password2, value, validatePassword2(state.password.value, value))
    })
  })

  on(actions.updateErrors, (state, value) => {
    return Object.assign({}, state, {errors: value})
  })

  on(actions.closeErrors, (state) => {
    return Object.assign({}, state, {errors: null})
  })

  on(actions.success, (state) => {
    return Object.assign({}, state, {step: "success"})
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:26,代码来源:resetPasswordStore.ts

示例3: LocalStore

export const showListStore = () => LocalStore(initialState, on => {
  on(actions.updateList, (state, shows) => {
    return copy(state, {
      nextShows: shows.filter(_ => _.plays && _.plays.length),
      previousShows: shows.filter(_ => !(_.plays && _.plays.length))
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:8,代码来源:showListStore.ts

示例4: LocalStore

export const playPageStore = () => LocalStore(initialState, on => {
  on(actions.initialize, (state, {company, show, play, playsFromShow}) => {
    return copy(state, {
      company, show, play,
      otherPlays: arrays.sort(playsFromShow.filter(p => p.id !== play.id), (p1, p2) => p1.date.getTime() - p2.date.getTime())
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:8,代码来源:playPageStore.ts

示例5: LocalStore

export const companyListStore = () => LocalStore(initialState, on => {
  on(actions.updateList, (state, companies) => {
    return copy(state, {
      vepCompanies: arrays.sort(companies.filter(_ => _.isVep), compareCompanies),
      notVepCompanies: arrays.sort(companies.filter(_ => !_.isVep), compareCompanies)
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:8,代码来源:companyListStore.ts

示例6: LocalStore

export const adhesionListStore = () => LocalStore(initialState, on => {
  on(actions.initialize, (state, {period, adhesions}) => {
    return copy(state, {
      period: period,
      acceptedAdhesions: adhesions.filter(_ => _.accepted),
      notAcceptedAdhesions: adhesions.filter(_ => !_.accepted)
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:9,代码来源:adhesionListStore.ts

示例7: LocalStore

export const navigationStore = () => LocalStore(initialState, on => {
  on(actions.initialize, (state, {shows, plays, pages}) => {
    return copy(state, {shows, plays, pages})
  })

  on(actions.updateSession, (state, session) => {
    return copy(state, {session})
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:9,代码来源:NavigationStore.ts

示例8: LocalStore

export const requestAdhesionFormStore = () => LocalStore(initialState, on => {
  on(actions.initialize, (state, {acceptedPeriods}) => {
    return copy(state, {step: "form", acceptedPeriods})
  })

  on(actions.updatePeriod, (state, value) => {
    return copy(state, {
      period: updateFieldValidation(state.period, value, Valid(value))
    })
  })

  on(actions.addMember, (state) => {
    const newMembers = arrays.append(state.members.value, defaultMember)
    return copy(state, {
      members: updateFieldValidation(state.members, newMembers, validateMembers(newMembers))
    })
  })

  on(actions.removeMember, (state, index) => {
    const newMembers = arrays.remove(state.members.value, index)
    return copy(state, {
      members: updateFieldValidation(state.members, newMembers, validateMembers(newMembers))
    })
  })

  on(actions.updateMemberFirstName, (state, {index, value}) =>
    updateMember(state, index, member => copy(member, {
      firstName: updateFieldValidation(member.firstName, value, validateNonBlank(value))
    }))
  )

  on(actions.updateMemberLastName, (state, {index, value}) =>
    updateMember(state, index, member => copy(member, {
      lastName: updateFieldValidation(member.lastName, value, validateNonBlank(value))
    }))
  )

  on(actions.updateMemberBirthday, (state, {index, value}) =>
    updateMember(state, index, member => copy(member, {
      birthday: updateFieldValidation(member.birthday, value, validatePassed(value))
    }))
  )

  on(actions.updateMemberActivity, (state, {index, value}) =>
    updateMember(state, index, member => copy(member, {
      activity: updateFieldValidation(member.activity, value, Valid(value))
    }))
  )

  on(actions.closeErrors, (state) => {
    return copy(state, {errors: null})
  })

  on(actions.success, (state) => {
    return copy(state, {step: "success"})
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:57,代码来源:requestAdhesionFormStore.ts

示例9: LocalStore

export const periodAdhesionListStore = () => LocalStore(initialState, on => {
  on(actions.updateList, (state, periodsAdhesion) => {
    return copy(state, {
      currentPeriodsAdhesion: periodsAdhesion.filter(_ => isCurrent(_.period)),
      futurePeriodsAdhesion: periodsAdhesion.filter(_ => isFuture(_.period)),
      passedPeriodsAdhesion: periodsAdhesion.filter(_ => isPassed(_.period))
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:9,代码来源:periodAdhesionListStore.ts

示例10: LocalStore

export const profilePageStore = () => LocalStore(initialState, on => {
  on(actions.initialize, (state, {profile, adhesions}) => {
    return copy(state, {
      profile: profile,
      acceptedAdhesions: adhesions.filter(_ => _.accepted),
      notAcceptedAdhesions: adhesions.filter(_ => !_.accepted)
    })
  })
})
开发者ID:kneelnrise,项目名称:vep,代码行数:9,代码来源:profilePageStore.ts


注:本文中的fluxx.LocalStore函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。