
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A lightweight promise based package to load scripts on the fly.
# Using npm
$ npm install get-js --save
# Using Yarn
$ yarn add get-js
# Using Bower
$ bower install get-js --save
You'll also need a Promise polyfill for older browsers.
# Install promise polyfill.
$ npm install es6-promise
Include the package using Common JS require()
or ES2015 import
:
var get = require('get-js');
// ES2015+
import get from 'get-js';
Or, using <script>
tags:
<script type="text/javascript" src="/path/to/get-js/dist/get.min.js"></script>
Here you go:
// Load single script
get('https://code.jquery.com/jquery-2.2.3.min.js').then(function() {
console.log('do something');
});
// Load multiple scripts, without changing the order
get(['/js/abc.js', '/js/xyz.js'])
.then(function() {
console.log('do something now');
})
.catch(function() {
console.log('error');
});
Note: This refers to angular 1.x projects.
You can also inject this in your angular files as a $q
friendly angular service.
Require the angular module using
var angularGetJs = require('get-js/angular');
Or
<script type="text/javascript" src="/path/to/get-js/dist/angular-get.min.js"></script>
Then you should be able to use it like this
// Add the module as a dependency in your app.
angular.module('app', ['angularGetJs']);
// Inject the service
angular.module('app').controller('MyController', [
'get',
function(get) {
get('/some/script.js')
.then(function() {
console.log('do something now');
})
.catch(function() {
console.log('error');
});
}
]);
This package is licensed under the MIT License.
FAQs
A lightweight library to asynchronously load scripts on the fly.
We found that get-js 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.