-
public class CTVariablesPackage Private class to not allow external access to working of Variables
-
-
Field Summary
Fields Modifier and Type Field Description private booleanhasVarsRequestCompleted
-
Constructor Summary
Constructors Constructor Description CTVariables(VarCache varCache)
-
Method Summary
Modifier and Type Method Description voidsetHasVarsRequestCompleted(boolean completed)voidinit()voidhandleVariableResponse(@Nullable() JSONObject response, @Nullable() FetchVariablesCallback fetchCallback)voidhandleVariableResponseError(@Nullable() FetchVariablesCallback fetchCallback)voidclearUserContent()clear current variable data. voidaddVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)Note: it is necessary to call the listeners immediately after user adds a listener using this functionbecause there is no guarantee that the newly added listener is going to be called later. voidaddOneTimeVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)Note: Following the similar logic as mentioned in the comment on addVariablesChangedCallback,if a user adds a OneTimeVariablesChangedHandler using this function AFTER the variable data is received,(and one time handlers already triggered), the user will not have their newlyadded handlers triggered ever. voidonVariablesChangedAndNoDownloadsPending(@NonNull() VariablesChangedCallback callback)Note: it is necessary to call the listeners immediately after user adds a listener using this functionbecause there is no guarantee that the newly added listener is going to be called later. voidonceVariablesChangedAndNoDownloadsPending(@NonNull() VariablesChangedCallback callback)Note: Following the similar logic as mentioned in the comment on addVariablesChangedCallback,if a user adds a OneTimeVariablesChangedHandler using this function AFTER the variable data is received,(and one time handlers already triggered), the user will not have their newlyadded handlers triggered ever. voidremoveVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)voidremoveOneTimeVariablesChangedHandler(@NonNull() VariablesChangedCallback callback)voidremoveAllVariablesChangedCallbacks()voidremoveAllOneTimeVariablesChangedCallbacks()BooleanhasVarsRequestCompleted()-
-
Constructor Detail
-
CTVariables
CTVariables(VarCache varCache)
-
-
Method Detail
-
setHasVarsRequestCompleted
void setHasVarsRequestCompleted(boolean completed)
-
init
void init()
-
handleVariableResponse
void handleVariableResponse(@Nullable() JSONObject response, @Nullable() FetchVariablesCallback fetchCallback)
-
handleVariableResponseError
void handleVariableResponseError(@Nullable() FetchVariablesCallback fetchCallback)
-
clearUserContent
void clearUserContent()
clear current variable data.can be used during profile switch
-
addVariablesChangedCallback
void addVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)
Note: it is necessary to call the listeners immediately after user adds a listener using this functionbecause there is no guarantee that the newly added listener is going to be called later. we only receive variable data (and trigger handlers) on certain event calls that happens asynchronously,so if client registers the listeners after such events have triggered,they should still be able to get those previously updated values
-
addOneTimeVariablesChangedCallback
void addOneTimeVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)
Note: Following the similar logic as mentioned in the comment on addVariablesChangedCallback,if a user adds a OneTimeVariablesChangedHandler using this function AFTER the variable data is received,(and one time handlers already triggered), the user will not have their newlyadded handlers triggered ever. therefore, it is necessary to trigger the user's handlersimmediately once this function is called
-
onVariablesChangedAndNoDownloadsPending
void onVariablesChangedAndNoDownloadsPending(@NonNull() VariablesChangedCallback callback)
Note: it is necessary to call the listeners immediately after user adds a listener using this functionbecause there is no guarantee that the newly added listener is going to be called later. we only receive variable data (and trigger handlers) on certain event calls that happens asynchronously,so if client registers the listeners after such events have triggered,they should still be able to get those previously updated values
-
onceVariablesChangedAndNoDownloadsPending
void onceVariablesChangedAndNoDownloadsPending(@NonNull() VariablesChangedCallback callback)
Note: Following the similar logic as mentioned in the comment on addVariablesChangedCallback,if a user adds a OneTimeVariablesChangedHandler using this function AFTER the variable data is received,(and one time handlers already triggered), the user will not have their newlyadded handlers triggered ever. therefore, it is necessary to trigger the user's handlersimmediately once this function is called
-
removeVariablesChangedCallback
void removeVariablesChangedCallback(@NonNull() VariablesChangedCallback callback)
-
removeOneTimeVariablesChangedHandler
void removeOneTimeVariablesChangedHandler(@NonNull() VariablesChangedCallback callback)
-
removeAllVariablesChangedCallbacks
void removeAllVariablesChangedCallbacks()
-
removeAllOneTimeVariablesChangedCallbacks
void removeAllOneTimeVariablesChangedCallbacks()
-
hasVarsRequestCompleted
Boolean hasVarsRequestCompleted()
-
-
-
-