![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
manage-libs-versions
Advanced tools
Easily create a list of Radio Inputs to let user choose Library Versions, retrieve the selection and prepare a list of Assets to be dynamically loaded.
Easily create a list of Radio Inputs to let user choose Library Versions, retrieve the selection and prepare a list of Assets to be dynamically loaded.
The Assets list can be directly passed to
loadJsCss.list()
function.
This library uses a UMD wrapper.
If directly loaded into a browser, it assigns the manageLibsVersions
global variable.
HTML
<script src="manage-libs-versions.js"></script>
JavaScript
var lib1PathTemplateCss = 'https://unpkg.com/lib1@{{VERSION}}/dist/lib1.css';
var lib1PathTemplateJS = 'https://unpkg.com/lib1@{{VERSION}}/dist/lib1.js';
var lib2PathTemplateJs = 'https://unpkg.com/lib2@{{VERSION}}/dist/lib2.js';
var bundle = new manageLibsVersions.Bundle({
name: 'bundle',
libs: [{
name: 'lib1',
mandatory: true,
versions: [{
name: 'v2.0.0',
defaultVersion: true, // If no Version is specified, or the specified one is unknown, use this Version instead.
assets: [
manageLibsVersions.makeStylesheet(lib1PathTemplateCss, '2.0.0'),
manageLibsVersions.makeScript(lib1PathTemplateJS, '2.0.0')
]
}, {
name: 'v1.0.0',
defaultVersion: false,
disabled: true, // This will make the Radio Input disabled.
assets: [
manageLibsVersions.makeStylesheet(lib1PathTemplateCss, '1.0.0'),
manageLibsVersions.makeScript(lib1PathTemplateJS, '1.0.0')
]
}]
}, {
name: 'lib2',
versions: [{
name: 'dev',
assets: [{
type: 'script',
path: '../dist/bundle.js'
}]
}, {
name: 'v0.15.2',
assets: [
manageLibsVersions.makeScript(lib2PathTemplateJs, '0.15.2')
]
}]
}]
});
HTML
<p>Choose a version for lib1:</p>
<!-- Versions names can be separated by whitespace, comma (,) and/or semi-colon (;) -->
<div data-manage-lib="lib1" data-manage-versions="v2.0.0, v1.0.0"></div>
<p>Choose a version for lib2:</p>
<div data-manage-lib="lib2" data-manage-versions="dev, v0.15.2"></div>
<button id="reload">Reload with the above selected Versions</button>
<script src="https://unpkg.com/urijs@1.18.12/src/URI.min.js"></script>
<script src="https://unpkg.com/load-js-css@0.0.1/index.js"></script>
JavaScript
// Fill manage placeholders with Radio Inputs.
bundle.fillPlaceholders();
// Make sure lib2 dev version assets are available.
// If not, it will automatically disable the Radio Input and remove
// the defaultVersion flag.
bundle.getLibVersion('lib2', 'dev').checkAssetsAvailability(true)
.then(function () {
loadDependenciesAndPageScript();
})
.catch(function () {
bundle.getLibVersion('lib2', 'v0.15.2').defaultVersion = true;
loadDependenciesAndPageScript();
});
function loadDependenciesAndPageScript() {
// Read in the URL which Libraries Versions are requested.
var url = window.location.href;
// https://github.com/medialize/URI.js
var urlParts = URI.parse(url);
var queryStringParts = URI.parseQuery(urlParts.query);
// Get the Libraries Versions assets list and select the Radio Inputs,
// so that the user sees which Versions will be loaded.
var list = bundle.getAndSelectVersionsAssetsList(queryStringParts);
// Finally include the page script, now that lib1 and lib2 dependencies
// are available.
list.push({
type: 'script',
path: './index.js'
});
// https://github.com/ghybs/load-js-css
loadJsCss.list(list, {
// Load scripts after stylesheets, delayed by this duration (in ms).
// Typically if a Library expects that its stylesheet is applied
// when its script executes.
delayScripts: 500
});
}
document.getElementById('reload').addEventListener('click', function (event) {
event.preventDefault();
// Read the checked Radio Inputs (i.e. which Versions the user has selected).
var bundleVersions = bundle.readSelectedVersionsNames();
// Build a new URL including those Versions requests as Query part.
var url = new URI(window.location.href).setQuery(bundleVersions);
// Reload the page with the new requested Versions.
window.location.href = url.toString();
});
Manage Libs Versions library is distributed under the ISC License.
FAQs
Easily create a list of Radio Inputs to let user choose Library Versions, retrieve the selection and prepare a list of Assets to be dynamically loaded.
The npm package manage-libs-versions receives a total of 56 weekly downloads. As such, manage-libs-versions popularity was classified as not popular.
We found that manage-libs-versions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.