On Mon, Aug 27, 2012 at 6:32 AM, Shijun He <[email protected]> wrote: > It seems current loader spec is so simple and I'm full of confusion of > baseURL props. > > > // lib/a.js > > System.baseURL // "lib/a.js" ??
No, the base url will be an absolute URL, like 'http://example.com/lib/a.js'. > System.load('b.js', ...) // I suppose this should load "lib/b.js", right? Yes. > var myLoader = new Loader(System, { baseURL: 'mypath/c.js' , fetch:myFetch }) > > myLoader.baseURL // 'mypath/c.js' or 'lib/mypath/c.js' or any other value? 'mypath/c.js', which is what you provided as the 'baseURL'. > myLoader.load('b.js' ...) // load 'lib/mypath/b.js' or 'lib/b.js' ? Neither -- this invokes the `fetch` hook with relative url 'b.js', and the base url 'mypath/c.js' -- it's up to the fetch hook to determine what to do with it. But 'lib' isn't in either of those arguments (although `myFetch` might contain a reference to `System.baseURL`). > function myFetch(relURL, baseURL, ...) { > relURL // 'b.js' or 'mypath/b.js' or any other value? > baseURL // ? > } See above. > and what happens if I call myLoader in other code for example which > url is '/otherpath/' ? I don't understand what you're asking here. -- sam th [email protected] _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

