Namespace util.lock
These functions all deal with locking game state when there is some blocking action in progress. Like don't allow game simulations when a trade is being negotiated. For figuring out the current state, trust only the database.
Defined in: <js/util/lock.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
util.lock.canStartGames(ot, cb)
Can new game simulations be started?
Calls the callback function with either true or false.
|
<static> |
util.lock.canStartNegotiation(ot, cb)
Can a new contract negotiation be started?
Calls the callback function with either true or false.
|
<static> |
util.lock.gamesInProgress(ot, cb)
Is game simulation in progress?
Calls the callback function with either true or false depending on whether there is a game simulation currently in progress.
|
<static> |
util.lock.negotiationInProgress(ot, cb)
Is a negotiation in progress?
Calls the callback function with either true or false depending on whether there is an ongoing negoation.
|
Method Detail
<static>
util.lock.canStartGames(ot, cb)
Can new game simulations be started?
Calls the callback function with either true or false. If games are in progress or any contract negotiation is in progress, false.
- Parameters:
- {IDBObjectStore|IDBTransaction|null} ot
- An IndexedDB object store or transaction on gameAttributes and negotiations; if null is passed, then a new transaction will be used.
- {function(boolean)} cb
- Callback.
<static>
util.lock.canStartNegotiation(ot, cb)
Can a new contract negotiation be started?
Calls the callback function with either true or false. If games are in progress or a free agent (not resigning!) is being negotiated with, false.
- Parameters:
- {IDBObjectStore|IDBTransaction|null} ot
- An IndexedDB object store or transaction on gameAttributes and negotiations; if null is passed, then a new transaction will be used.
- {function(boolean)} cb
- Callback.
<static>
util.lock.gamesInProgress(ot, cb)
Is game simulation in progress?
Calls the callback function with either true or false depending on whether there is a game simulation currently in progress.
- Parameters:
- {IDBObjectStore|IDBTransaction|null} ot
- An IndexedDB object store or transaction on gameAttributes; if null is passed, then a new transaction will be used.
- {function(boolean)} cb
- Callback.
<static>
util.lock.negotiationInProgress(ot, cb)
Is a negotiation in progress?
Calls the callback function with either true or false depending on whether there is an ongoing negoation.
- Parameters:
- {IDBObjectStore|IDBTransaction|null} ot
- An IndexedDB object store or transaction on negotiations; if null is passed, then a new transaction will be used.
- {function(boolean)} cb
- Callback.