SimpleRequiresProvidesProposal
From OpenLaszlo
Laszlo needs a system for specifying runtime-specific constraints, e.g. drawview only works under the flash runtime. This will be used to turn on/off specific behaviors within the kernel and components, and warn when features are unavailable on a specific runtime or platform.
Eventually this spec can be formalized as part of the LZX language and warnings can be generated at compile time, but for now it can be done at runtime.
Contents |
Status
This is a draft, and will be expanded and updated as refactoring continues in Legals.
Contributors
Max Carlson wrote this proposal.
Implementation
core
$modules.runtime = {};
$modules.runtime.requires = {};
$modules.runtime.provides = {};
possible runtime registry for DHTML kernel
$modules.runtime.requires = visible_on_image_load (for Safari) $modules.runtime.requires = alpha_image_loader (for IE PNG/opacity support) $modules.runtime.requires = stretch_leaf_views_only (DHTML constraint) $modules.runtime.requires = prefer_png_assets (compiler prefers .png over .swf) $modules.runtime.provides = visible_on_image_load $modules.runtime.provides = alpha_image_loader $modules.runtime.provides = stretch_leaf_views_only $modules.runtime.provides = prefer_png_assets
possible runtime registry for SWF kernel
$modules.runtime.provides = stretch_subviews $modules.runtime.provides = mp3_streaming $modules.runtime.provides = whatwg_canvas $modules.runtime.requires = prefer_swf_assets (compiler prefers .swf over .png where available)
Implementation Notes
First a small runtime stub runs early and sets appropriate requires entries. For example, alpha_image_loader for IE.
Then the LFC starts and gives early warnings for non-matching entries for requires and provides.
Components (e.g. drawview) declare requires early on, warn if there are no matching provides entries, and warn again when the component is used. For example, drawview would add an entry for runtime.requires whatwg_canvas, so warnings can be issued in DHTML where it's not available.

