Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
backbone_es6
Advanced tools
This repo contains an ES6 version of Backbone.js allowing for imports and tree shaking.
This package is made by deconstructing Backbone sources, separating it into modules and reassembling them using Rollup.
Tree shaking allows you to include just the code you need instead of a whole library. Say, for example, your app needs to use just Backbone's router, you can import just that part, resulting in a smaller build size overall.
To use this library, your project sould already have
They aren't explicitly listed as dependencies in package.json
(for npm nor jspm), because you might want to use other drop in replacements for these dependencies
(for example, lodash@^3 instead of Underscore, or jquery.slim.js build instead of jquery.min.js).
Include this package in your HTML file directly with a script tag using unpkg or jsdelivr
<script src="https://unpkg.com/backbone_es6/dist/backbone.min.js"></script>
or
<script src="https://cdn.jsdelivr.net/npm/backbone_es6/dist/backbone.min.js"></script>
Install this package with npm with
npm install --save backbone_es6
jspm install npm:backbone_es6
Yes you can. Under the dist
folder you can find scripts backbone.js
and backbone.min.js
that are in UMD format and can be used as a drop-in replacement for goold old vanilla Backbone. The minified version is listed as the main
property in package.json
so it's what you'll use by default.
These scripts are also used to run the tests. Said tests are the same as the ones in the official Backbone repo, to ensure full Backbone ES6's compatibility with its parent framework.
If you use AMD, CommonJS or want to load Backbone ES6 with a script tag, make sure you use dist/backbone.js
or dist/backbone.min.js
. E.g. AMD usage of our umd version is as follows:
define([
'./node_modules/backbone_es6/dist/backbone.js'
],function(Backbone) {
...your code...
});
Whereas, using ES6 syntax, you would use
import {Backbone} from './node_modules/backbone_es6/dist/backbone.es6.js';
package.json
declares dist/backbone.es6.js
as the jsnext:main
and module
script properties.
If you installed Backbone ES6 with jspm, backbone_es6
will be mapped automatically to dist/backbone.es6.js
. If you're tranpiling (using plugin-babel) you can import the module as:
import {Backbone} from 'backbone_es6';
or you could use AMD syntax as:
define([
'backbone_es6'
],function(Backbone) {
// Please note that you need to check for the "default" export
Backbone = 'default' in Backbone ? Backbone.default : Backbone;
...your code...
});
If you are not using a transpiler and want to use the AMD build, use:
define([
'backbone_es6/backbone.min.js'
],function(Backbone) {
...your code...
});
Nope. The inner working of Backbone entities and the way they extend is kept as-is. This project is only a POC to do imports and tree shaking. No more, no less.
As this library is meant to be a full drop-in replacement of Backbone.js, the same docs apply.
FAQs
Backbone library in ES6 flavor
The npm package backbone_es6 receives a total of 0 weekly downloads. As such, backbone_es6 popularity was classified as not popular.
We found that backbone_es6 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.