redopop / dq Goto Github PK
View Code? Open in Web Editor NEWTiny inline initializers for asynchronously-loaded JavaScript.
License: MIT License
Tiny inline initializers for asynchronously-loaded JavaScript.
License: MIT License
It's currently named callback
which is confusing. eachItem
may be a better name.
dq();
q('method');
This is not an edge case. Very common for <script async>
use.
To take advantage of browser caching, it's common for optimized RequireJS builds to distribute modules across multiple files (one for common components, and one that's more page-specific).
In such cases, it seems appropriate and DRY to register modules without dq'ing. Currently, the two are tightly coupled: the only time you can register modules is when you want to dequeue your entire list of calls.
An alternative: dq currently throws an error when it encounters modules that haven't loaded. Instead, it could implicitly understand that a second dq call will follow. This way, modules can be registered and executed asynchronously.
q('module.submodule.method')
The code for resolving these paths is borrowed from this gist, but there is no test in dq covering it.
Add a test to make sure q('moduleName.methodName')
results in methodName
being called with moduleName
as its context.
Related to #2 โ this use of dq currently fails.
Calling dq
multiple times results in previously queued items being called again with the same params.
This could be handled more gracefully by emptying the queue for subsequent dq calls.
Current test runner is pure JS only. Add an AMD test runner to make sure dq is healthily maintained for that environment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.