just.Def(idnullable, dependencyIDs, value)Define a value after all dependencies became available.Source:just.js, line 2267Parameters:NameTypeDescriptionid[nullable]stringThe module id.dependencyIDsstring[] or stringRequired module ids.valueAnyThe module value.ExampleExample 1.// https://some.cdn/js/just.js window.just = {'Define': function () {}}; // index.html < !DOCTYPE html> < html data-just-Define='{"main": "/js/main.js"}'> < head> < title>Test</title> < script src='https://some.cdn/js/just.js' async></script> < /head> < body> < /body> < /html> // /js/main.js just.Define.configure({ 'globals': { // Set justJs to window.just 'justJs': function () { return just; } }, 'urls': { // Load "/css/index.css" when "index.css" is required. 'index.css': '/css/index.css' }, 'nonScripts': { // Call when "main.html" is required. 'main.html': function () { return '<main></main>'; } } }); // Load when document, justJs and index.css are ready: just.Define('main', ['justJs', 'index.css'], function (j) { if (j.supportsTouch()) { j.Define('mobile', 'https://example/m'); return; } j.Define('non-mobile', ['main.html']); }); // Call only if j.supportsTouch() just.Define(['mobile'], function (url) { window.redirect = url; }); // Call when main.html is ready. just.Define(['non-mobile'], function (html) { document.body.innerHTML = html; });