SLB: Notes – Client Files: Context Callbacks
By Sol in Lab
Invalid Callbacks
How to handle invalid callbacks?
Options
- Current: Remove context completely
- Other valid contexts will still be evaluated
- If no other contexts exist, file will always be loaded
- Pass all callbacks to
register method (whether valid or not
- Allow
register method to determine how to handle invalid callbacks
- Extra processing for file that should not be loaded
- Remove callback and evaluate just context (string)
- Callback is meant to be a condition of loading file
- Removal of callback will cause undesired loading of files
- Track if no valid context exist for file (after parsing)
- Remove files with no valid contexts
- Files defined with empty contexts are allowed to pass
- Use flag to track during parsing
- Example:
$valid_context = false until valid context encountered
- If flag is
false after all contexts evaluated, remove file
? Are there other conditions that should still allow file to load?
- e.g.
callback property
A: If contexts are set but all are invalid, global callback doesn’t matter
- Contexts & global callback are both evaluated when loading file