concent

concent

  • Docs
  • API
  • ChangeLog
  • GitHub

›顶层api

顶层api

  • run
  • configure
  • cloneModule
  • register
  • connect
  • connectDumb
  • emit
  • emitWith
  • dispatch
  • getState
  • getGlobalState
  • getComputed
  • setState
  • setGlobalState
  • call
  • execute
  • executeAll

通用类型解释

  • HandlerCtx
  • CcFragmentCtx
  • WatchFn

实例上下文api

  • ctx.dispatch
  • ctx.invoke
  • ctx.setState
  • ctx.setModuleState
  • ctx.setGlobalState
  • ctx.computed
  • ctx.watch
  • ctx.syncBool
  • ctx.set
  • ctx.emit
  • ctx.on
  • ctx.off

CcFragment api

  • Fifth Document

通用api

  • dispatch

更新全局模块的状态


更新concent内置模块$$global的状态

函数签名

setGlobalState: (state:object)=>void

如果使用

import { setGlobalState } from 'concent';
// import cc from 'concent'; cc.setGlobalState

setGlobalState({themeColor:'red'});

何时使用

在cc类外部、reducer方法外部时想要设置全局模块的状态

等同于调用setState('$$global', {themeColor:'red'})

console里使用

打开浏览器console窗口,输入cc.setGlobalState即可以console里使用该接口

← setStatecall →
  • 函数签名
  • 如果使用
  • 何时使用
  • console里使用
Copyright © 2019 concentjs.org