berklee / nbl Goto Github PK
View Code? Open in Web Editor NEWNBL is a tiny non-blocking JavaScript lazy loader
Home Page: http://berklee.github.com/nbl/
NBL is a tiny non-blocking JavaScript lazy loader
Home Page: http://berklee.github.com/nbl/
I'm looking for a way to get a global callback when all of my scripts have finished loading asynchronously, is this possible?
Why you won't provide some JS api like:
nbl.load([], callback)
frustrating
There are a lot of JS loaders, really. But none of them, at least within documentation, addresses a problem I'm eager to solve. That is to use single <script>
line per whole project which inits page-based loading of dependencies.
Let's create a simple project with index, portfolio, and contacts pages.
Microframework will help us with routing:
$app->get('/portfolio/',
function () use ($app) {
$prices = array(
"price_mine" => "90",
"price_rival" => "120"
);
$app->render('portfolio.twig', $prices);
})->name('portfolio');
Template engine will help us with rendering:
{% extends "base.twig" %}
{% block content %}
<p>Aren't you sick and tired to pay {{price_rival}}…</p>.
{% endblock content %}
And the missing part in every page is <script src="/static/init.js"></script>
that works as follows
What's the best way to achieve it?
And how to do that with NBL whether it's possible?
Thank you in advance.
Warm regards from Russia, Alexander.
Small issue on line 18 in https://github.com/berklee/nbl/blob/master/nbl.js
is .... i = j = 0, which makes j available globally (window.j in my case).
I suggest to declare it locally ... i = 0, j = 0,
In https://github.com/berklee/nbl/blob/master/nbl.plus.js
you have following regex: t = u[0].match(/.([cjs]{2,4})$|?.+/i); t = (t) ? t[1] : "i";
This doesn't produce good result when i had this.nbl.l(["http://itstatic.blob.core.windows.net/davatakiplerimcss/davaTakiplerimHomePageCombinedCSS.css?version=20"]);
I have changed it to something like below and it worked
.match(/.([cjs]{2,4})(|?.+)$/i)
wrong for '.../myscript.js?version=xxx' in nbl.plus
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.