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

2017 Loader Re-Write #166

Open
4 tasks
cycomachead opened this issue Aug 30, 2017 · 1 comment
Open
4 tasks

2017 Loader Re-Write #166

cycomachead opened this issue Aug 30, 2017 · 1 comment

Comments

@cycomachead
Copy link
Member

cycomachead commented Aug 30, 2017

Lunch Time thoughts..

  • Replace SetTimeout w/ an onload for each script, that calls the section loaded function, and the load next section function if everything is good
  • Add a hook for scripts that can be conditionally loaded, based on a CSS selector or function.

More difficult stuff:

  • define script dependencies and linearize a DAG
  • allow all scripts to be loaded, but don't execute them until dependencies are loaded (requires adapting each script to not execute code immediately.
@cycomachead
Copy link
Member Author

That last part is mostly done.

Perhaps we can define a module syntax?

llab.modules = {
   curriculum: {
      dependencies: ['jQuery', 'library'],
      path: 'src/curriculum.js',
      onLoad: function() {},
      ...,
  },
};

This feels like reinventing the wheel. Maybe a build system is still just easier. :/

Then we can have a meta onLoad function that checks if dependencies are ready and if so calls the onLoad for that module. Then if the dependencies aren't ready, it can create callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant