Closed szepeviktor closed 10 years ago
How about this?
curl.config({
paths: {
facebook: {
location: '//connect.facebook.net/en_US/all',
config: { loader: 'curl/loader/legacy', exports: 'FB' }
}
}
});
curl(['facebook']);
I don't understand the Analytics and Remarketing bits in the title. What do you mean, @szepeviktor?
this https://github.com/cujojs/curl/issues/241 and https://github.com/krux/postscribe/ which hijacks document.write of Remarketing tag script (this is my latest finding) And this is the AMD issue https://github.com/krux/postscribe/issues/37
What is the the difference between the outcome of js!
and loader/legacy
?
The legacy loader lets you reference a non-modular script as if it were a module:
// nice. looks like other modules. also: I think more like ES6 will be
define(['facebook'], function (fb) { /* ... */ });
rather than:
// kinda ugly and not cross-loader :(
define(['js!facebook!exports=FB'], function (fb) { /* ... */ });
Thank you very much.
Excuse me for asking.
How can I detect wheather a js!
script has already started loading? (to avoid loading it twice)
Hey Szépe,
In application code, you shouldn't need to detect whether a script is already loading. if you're using the js!
plugin, you must ensure that any options, such as !order
or !exports=…
, are the same or you may see double downloads. If the options and the url are the same, the file will only be downloaded once. The legacy loader should never download more than once.
If you are building a curl shim or curl loader and want to detect if curl is already handling a url, you can use curl's internal API to check if there is a promise in the cache. Let me know if you need more details about creating a curl shim or loader!
-- John
https://developers.facebook.com/docs/javascript/howto/requirejs says nice things about AMD:
Maybe
curl(['js!facebook!exports=window.FB']);
?