@cicada/render
Advanced tools
Comparing version 1.1.22-alpha12 to 1.1.22-alpha13
@@ -396,2 +396,7 @@ 'use strict'; | ||
function stateRegistered(statePath) { | ||
var state = get(statePath); | ||
return (state && state._id) !== undefined ? state : false; | ||
} | ||
return { | ||
@@ -421,2 +426,12 @@ get: guardWithPathDetect(get), | ||
register: function register(statePath, getInitialState, type, pathGetters, getStateProxy) { | ||
// CAUTION 允许两个组件同时订阅一份数据,这在 Table 之类的组件里面用到了。 | ||
var checkState = stateRegistered(statePath); | ||
if (checkState) { | ||
return { | ||
stateId: checkState._id, | ||
// CAUTION 只有第一注册的组件可以取消注册。 | ||
cancel: function cancel() {} | ||
}; | ||
} | ||
var stateId = registerToStateTree(statePath, getInitialState, pathGetters, getStateProxy); | ||
@@ -423,0 +438,0 @@ var cancelInitialState = registerInitialState(stateId, getInitialState, type); |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.22-alpha12", | ||
"version": "1.1.22-alpha13", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
414015
10012