Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading external resources #125

Open
lptr opened this issue Sep 10, 2014 · 2 comments
Open

Loading external resources #125

lptr opened this issue Sep 10, 2014 · 2 comments

Comments

@lptr
Copy link
Contributor

lptr commented Sep 10, 2014

Right now if a module wants to load external resources, it cannot reliable do that. There is a hack that you can write:

require("http://youtube.com/iframe_api", function { /* ... */ })

But doing so makes you implicitly rely on your module being packaged as AMD (i.e. that an async require() function is available in the context). Once you package the module in a Node JS app, it will break. There is already a plan to fix this, but we cannot do that until modules have a better way to access external resources: #122.

Proposal: add a function to the Spaghetti class (nee SpaghettiConfiguration, see #126), so modules can load resources like that. It should look something like this:

function getResource(url:String, onSuccess:Dynamic->Void, onError:Dynamic->Void = null);
@lptr lptr added this to the 2.1 milestone Sep 10, 2014
@lptr lptr changed the title Modules should be able to load external resources Loading external resources Sep 10, 2014
@lptr
Copy link
Contributor Author

lptr commented Sep 10, 2014

The implementation of this function would be different for Require and Node JS packaging.

@lptr
Copy link
Contributor Author

lptr commented Sep 10, 2014

In single file applications we could throw a runtime error, or we could assume that the application will be run as Node, and just use Node's require().

@lptr lptr modified the milestones: 2.1, 2.2 Nov 6, 2014
@lptr lptr removed this from the 2.1 milestone Feb 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants