Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13968 closed enhancement (fixed)

implement AMD loader plugin spec

Reported by: Rawld Gill Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: Loader Version: 1.7.0b1
Keywords: Cc: dante, bill
Blocked By: Blocking:

Description (last modified by Rawld Gill)

A plugin spec has been agreed on the AMD-implement list:

When the loader encounters a module id of the form "<x>!<y>", x a legal module name, y any string, the loader will understand that id as specifying that the loading of the plugin resource given by y should be delegated to module x. y is termed a plugin resource id (written as prid in the dojo code) and x is termed in the plugin module.

The plugin module must provide the function load that takes the three arguments:

id: the normalized prid

require: a context require function with respect to the module that contains the plugin resource demand in its dependency vector (this is termed the reference module)

loaded: the callback function to be applied to the resolved plugin resource by the plugin module; this callback informs the loader of the plugin resource value.

The loader will normalize the prid before calling load. The plugin module may optionally provide the function normalize that takes two arguments:

prid: the raw prid as provided in a dependency vector

toAbsMid: a function that converts a relative module id into an absolute module id with respect to the reference module (as described above)

If the plugin does not provide the normalize function, then the loader will attempt to convert any relative path segments contained in the raw prid into absolute path segments computed with respect to the reference module.

Given these two functions, when the loader is asked to resolve a plugin resource, it first normalizes the prid, and then passes the normalized prid to the plugin module's load function. When that load function applies the callback, the plugin resource is resolved.

If the plugin provides truthy for the property dynamic, then the loader will not cache resolved plugin resources; otherwise the loader will cache resolved plugin resources.

Change History (5)

comment:1 Changed 8 years ago by Rawld Gill

Status: newassigned

comment:2 Changed 8 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

In [26631]:

implemented enhanced AMD plugin spec; fixes #13968; !strict

comment:3 Changed 8 years ago by Rawld Gill

In [26632]:

removed cruft; refs #13968; !strict

comment:4 Changed 8 years ago by Rawld Gill

Description: modified (diff)

comment:5 Changed 8 years ago by Kenneth G. Franqueiro

It looks like the documentation of the id parameter was removed in the change to has.normalize. Not sure this was intentional.

Note: See TracTickets for help on using tickets.