@@ -15,6 +15,9 @@ function sepiaFW_build_ui_actions(){
1515 idleState : idleState ,
1616 id : delayId
1717 } ;
18+ //NOTE: At the time of this function call the state can actually BE IDLE (short transient)
19+ //Should we add a timeout fallback?
20+ //console.error("delayFunction", "state", SepiaFW.animate.assistant.getState()); //DEBUG
1821 }
1922 Actions . executeDelayedFunctionsAndRemove = function ( stateFilter ) {
2023 var cleanUpIds = [ ] ;
@@ -172,7 +175,8 @@ function sepiaFW_build_ui_actions(){
172175 actionFun = function ( ) {
173176 Actions . clientControlFun ( {
174177 "fun" : fun ,
175- "controlData" : act
178+ "controlData" : act ,
179+ "delayUntilIdle" : false
176180 } , sender ) ;
177181 } ;
178182 }
@@ -185,11 +189,25 @@ function sepiaFW_build_ui_actions(){
185189 parentBlock . appendChild ( funBtn ) ;
186190 }
187191 //CLIENT Control function
192+ /*
188193 Actions.clientControlFun = function(action, sender){
189194 if (action && action.fun){
190195 SepiaFW.client.controls.handle(action.fun, action.controlData);
191196 }
192197 }
198+ */
199+ Actions . clientControlFun = function ( action , sender , delayUntilIdle ) {
200+ if ( ! action || ! action . fun ) {
201+ return ;
202+ }
203+ if ( delayUntilIdle || action . delayUntilIdle ) {
204+ Actions . delayFunctionUntilIdle ( function ( ) {
205+ SepiaFW . client . controls . handle ( action . fun , action . controlData ) ;
206+ } , "any" ) ; //idleState req.
207+ } else {
208+ SepiaFW . client . controls . handle ( action . fun , action . controlData ) ;
209+ }
210+ }
193211
194212 //BUTTON URLs
195213 Actions . addButtonURL = function ( action , parentBlock ) {
0 commit comments