Skip to content

Commit 3e32ffa

Browse files
committed
added optional 'delayUntilIdle' for client control actions
1 parent 72cfd8d commit 3e32ffa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

www/scripts/sepiaFW.ui.actions.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)