mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-08 15:43:24 +00:00
Compare commits
8 Commits
e9e11d6157
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00a81e3ddf | ||
|
|
b1bc28996b | ||
|
|
f8457e4e98 | ||
|
|
5db12358f4 | ||
|
|
b340ab9c14 | ||
|
|
8930cd2dc7 | ||
|
|
dca241fc0b | ||
|
|
bb20540d68 |
41
.github/workflows/static.yml
vendored
Normal file
41
.github/workflows/static.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Simple workflow for deploying static content to GitHub Pages
|
||||||
|
name: Deploy static content to Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Runs on pushes targeting the default branch
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Single deploy job since we're just deploying
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v2
|
||||||
|
with:
|
||||||
|
# Upload entire repository
|
||||||
|
path: './docs'
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v2
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
bower_components
|
bower_components
|
||||||
dist
|
!docs/bower_components
|
||||||
|
/dist
|
||||||
node_modules
|
node_modules
|
||||||
.gitconfig
|
.gitconfig
|
||||||
*.swp
|
*.swp
|
||||||
|
|||||||
1
docs/.nojekyll
Normal file
1
docs/.nojekyll
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
48
docs/bower_components/backbone.babysitter/.bower.json
vendored
Normal file
48
docs/bower_components/backbone.babysitter/.bower.json
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.babysitter",
|
||||||
|
"version": "0.1.12",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.babysitter",
|
||||||
|
"authors": [
|
||||||
|
"Derick Bailey <derickbailey@gmail.com>"
|
||||||
|
],
|
||||||
|
"description": "Manage child views in a Backbone.View",
|
||||||
|
"main": "lib/backbone.babysitter.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"plugin",
|
||||||
|
"computed",
|
||||||
|
"field",
|
||||||
|
"model",
|
||||||
|
"client",
|
||||||
|
"browser"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": ">=0.9.9 <=1.3.x",
|
||||||
|
"underscore": ">=1.4.0 <=1.8.3"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests",
|
||||||
|
"public",
|
||||||
|
"specs",
|
||||||
|
".gitignore",
|
||||||
|
".jshintrc",
|
||||||
|
".travis.yml",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"component.json",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"_release": "0.1.12",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v0.1.12",
|
||||||
|
"commit": "e21524f2fd5164d2fb7a48c3c12d14c22175af4d"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/marionettejs/backbone.babysitter.git",
|
||||||
|
"_target": "^0.1.0",
|
||||||
|
"_originalSource": "backbone.babysitter"
|
||||||
|
}
|
||||||
83
docs/bower_components/backbone.babysitter/CHANGELOG.md
vendored
Normal file
83
docs/bower_components/backbone.babysitter/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Change log
|
||||||
|
|
||||||
|
### v0.1.12
|
||||||
|
|
||||||
|
* Bump version range of backbone support.
|
||||||
|
|
||||||
|
### v0.1.11
|
||||||
|
|
||||||
|
* Bump version range of backbone support.
|
||||||
|
|
||||||
|
### v0.1.10
|
||||||
|
|
||||||
|
* Bump version range of backbone support.
|
||||||
|
|
||||||
|
### v0.1.9
|
||||||
|
|
||||||
|
* Bump version range of backbone support.
|
||||||
|
|
||||||
|
### v0.1.8
|
||||||
|
|
||||||
|
* Bump version range of backbone and underscore support.
|
||||||
|
|
||||||
|
### v0.1.7
|
||||||
|
|
||||||
|
* Bump version range of backbone support.
|
||||||
|
|
||||||
|
### v0.1.6
|
||||||
|
|
||||||
|
* Expose `reduce` to babysitter collections. Thanks @romanbsd
|
||||||
|
|
||||||
|
### v0.1.5
|
||||||
|
|
||||||
|
* Minor updates to bower.json
|
||||||
|
|
||||||
|
### v0.1.4
|
||||||
|
|
||||||
|
* Update UMD Wrapper and build process
|
||||||
|
|
||||||
|
### v0.1.2
|
||||||
|
|
||||||
|
* Add .VERSION and n.oConflict
|
||||||
|
* General cleanups to tests and package.json
|
||||||
|
* Add travis build info
|
||||||
|
|
||||||
|
### v0.1.1
|
||||||
|
* Remove AMD builds and replace with a single UMD style wrapper.
|
||||||
|
|
||||||
|
### v0.1.0
|
||||||
|
* allow chaining of add and remove methods
|
||||||
|
* add component.json
|
||||||
|
|
||||||
|
#### General
|
||||||
|
* update grunt file
|
||||||
|
* readme fixed
|
||||||
|
* fix gruntfile url
|
||||||
|
|
||||||
|
### v0.0.6
|
||||||
|
|
||||||
|
* Removed `.findByCollection` method
|
||||||
|
* Added `.findByModelCid` method
|
||||||
|
|
||||||
|
### v0.0.5
|
||||||
|
|
||||||
|
* Updated build process to use GruntJS v0.4
|
||||||
|
|
||||||
|
### v0.0.4
|
||||||
|
|
||||||
|
* Added a fix for IE < 9, when applying a function to the views
|
||||||
|
* Added `.pluck` as a method, from Underscore.js
|
||||||
|
* Can specify an array of views to the container constructor
|
||||||
|
|
||||||
|
### v0.0.3
|
||||||
|
|
||||||
|
* Added iterators and other collection processing functions from Underscore.js
|
||||||
|
|
||||||
|
### v0.0.2
|
||||||
|
|
||||||
|
* Added `.length` attribute
|
||||||
|
* Added `.findByIndex` method
|
||||||
|
|
||||||
|
### v0.0.1
|
||||||
|
|
||||||
|
* Initial release
|
||||||
5
docs/bower_components/backbone.babysitter/LICENSE.md
vendored
Normal file
5
docs/bower_components/backbone.babysitter/LICENSE.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Backbone.BabySitter
|
||||||
|
|
||||||
|
Copyright (C)2013 Derick Bailey, Muted Solutions, LLC
|
||||||
|
|
||||||
|
Distributed Under [MIT License](http://mutedsolutions.mit-license.org/)
|
||||||
39
docs/bower_components/backbone.babysitter/bower.json
vendored
Normal file
39
docs/bower_components/backbone.babysitter/bower.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.babysitter",
|
||||||
|
"version": "0.1.11",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.babysitter",
|
||||||
|
"authors": [
|
||||||
|
"Derick Bailey <derickbailey@gmail.com>"
|
||||||
|
],
|
||||||
|
"description": "Manage child views in a Backbone.View",
|
||||||
|
"main": "lib/backbone.babysitter.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"plugin",
|
||||||
|
"computed",
|
||||||
|
"field",
|
||||||
|
"model",
|
||||||
|
"client",
|
||||||
|
"browser"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": ">=0.9.9 <=1.3.x",
|
||||||
|
"underscore": ">=1.4.0 <=1.8.3"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests",
|
||||||
|
"public",
|
||||||
|
"specs",
|
||||||
|
".gitignore",
|
||||||
|
".jshintrc",
|
||||||
|
".travis.yml",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"component.json",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
190
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.js
vendored
Normal file
190
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.js
vendored
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
// Backbone.BabySitter
|
||||||
|
// -------------------
|
||||||
|
// v0.1.11
|
||||||
|
//
|
||||||
|
// Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
|
||||||
|
// Distributed under MIT license
|
||||||
|
//
|
||||||
|
// http://github.com/marionettejs/backbone.babysitter
|
||||||
|
|
||||||
|
(function(root, factory) {
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['backbone', 'underscore'], function(Backbone, _) {
|
||||||
|
return factory(Backbone, _);
|
||||||
|
});
|
||||||
|
} else if (typeof exports !== 'undefined') {
|
||||||
|
var Backbone = require('backbone');
|
||||||
|
var _ = require('underscore');
|
||||||
|
module.exports = factory(Backbone, _);
|
||||||
|
} else {
|
||||||
|
factory(root.Backbone, root._);
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this, function(Backbone, _) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var previousChildViewContainer = Backbone.ChildViewContainer;
|
||||||
|
|
||||||
|
// BabySitter.ChildViewContainer
|
||||||
|
// -----------------------------
|
||||||
|
//
|
||||||
|
// Provide a container to store, retrieve and
|
||||||
|
// shut down child views.
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||||
|
|
||||||
|
// Container Constructor
|
||||||
|
// ---------------------
|
||||||
|
|
||||||
|
var Container = function(views){
|
||||||
|
this._views = {};
|
||||||
|
this._indexByModel = {};
|
||||||
|
this._indexByCustom = {};
|
||||||
|
this._updateLength();
|
||||||
|
|
||||||
|
_.each(views, this.add, this);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Container Methods
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
_.extend(Container.prototype, {
|
||||||
|
|
||||||
|
// Add a view to this container. Stores the view
|
||||||
|
// by `cid` and makes it searchable by the model
|
||||||
|
// cid (and model itself). Optionally specify
|
||||||
|
// a custom key to store an retrieve the view.
|
||||||
|
add: function(view, customIndex){
|
||||||
|
var viewCid = view.cid;
|
||||||
|
|
||||||
|
// store the view
|
||||||
|
this._views[viewCid] = view;
|
||||||
|
|
||||||
|
// index it by model
|
||||||
|
if (view.model){
|
||||||
|
this._indexByModel[view.model.cid] = viewCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// index by custom
|
||||||
|
if (customIndex){
|
||||||
|
this._indexByCustom[customIndex] = viewCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._updateLength();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by the model that was attached to
|
||||||
|
// it. Uses the model's `cid` to find it.
|
||||||
|
findByModel: function(model){
|
||||||
|
return this.findByModelCid(model.cid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by the `cid` of the model that was attached to
|
||||||
|
// it. Uses the model's `cid` to find the view `cid` and
|
||||||
|
// retrieve the view using it.
|
||||||
|
findByModelCid: function(modelCid){
|
||||||
|
var viewCid = this._indexByModel[modelCid];
|
||||||
|
return this.findByCid(viewCid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by a custom indexer.
|
||||||
|
findByCustom: function(index){
|
||||||
|
var viewCid = this._indexByCustom[index];
|
||||||
|
return this.findByCid(viewCid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find by index. This is not guaranteed to be a
|
||||||
|
// stable index.
|
||||||
|
findByIndex: function(index){
|
||||||
|
return _.values(this._views)[index];
|
||||||
|
},
|
||||||
|
|
||||||
|
// retrieve a view by its `cid` directly
|
||||||
|
findByCid: function(cid){
|
||||||
|
return this._views[cid];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove a view
|
||||||
|
remove: function(view){
|
||||||
|
var viewCid = view.cid;
|
||||||
|
|
||||||
|
// delete model index
|
||||||
|
if (view.model){
|
||||||
|
delete this._indexByModel[view.model.cid];
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete custom index
|
||||||
|
_.any(this._indexByCustom, function(cid, key) {
|
||||||
|
if (cid === viewCid) {
|
||||||
|
delete this._indexByCustom[key];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// remove the view from the container
|
||||||
|
delete this._views[viewCid];
|
||||||
|
|
||||||
|
// update the length
|
||||||
|
this._updateLength();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Call a method on every view in the container,
|
||||||
|
// passing parameters to the call method one at a
|
||||||
|
// time, like `function.call`.
|
||||||
|
call: function(method){
|
||||||
|
this.apply(method, _.tail(arguments));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Apply a method on every view in the container,
|
||||||
|
// passing parameters to the call method one at a
|
||||||
|
// time, like `function.apply`.
|
||||||
|
apply: function(method, args){
|
||||||
|
_.each(this._views, function(view){
|
||||||
|
if (_.isFunction(view[method])){
|
||||||
|
view[method].apply(view, args || []);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Update the `.length` attribute on this container
|
||||||
|
_updateLength: function(){
|
||||||
|
this.length = _.size(this._views);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Borrowing this code from Backbone.Collection:
|
||||||
|
// http://backbonejs.org/docs/backbone.html#section-106
|
||||||
|
//
|
||||||
|
// Mix in methods from Underscore, for iteration, and other
|
||||||
|
// collection related features.
|
||||||
|
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||||
|
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||||
|
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||||
|
'last', 'without', 'isEmpty', 'pluck', 'reduce'];
|
||||||
|
|
||||||
|
_.each(methods, function(method) {
|
||||||
|
Container.prototype[method] = function() {
|
||||||
|
var views = _.values(this._views);
|
||||||
|
var args = [views].concat(_.toArray(arguments));
|
||||||
|
return _[method].apply(_, args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// return the public API
|
||||||
|
return Container;
|
||||||
|
})(Backbone, _);
|
||||||
|
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer.VERSION = '0.1.11';
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer.noConflict = function () {
|
||||||
|
Backbone.ChildViewContainer = previousChildViewContainer;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Backbone.ChildViewContainer;
|
||||||
|
|
||||||
|
}));
|
||||||
1
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.map
vendored
Normal file
1
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.map
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["?"],"names":["root","factory","define","amd","Backbone","_","exports","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAOJ,GAAQG,EAAUC,SAEtB,IAAuB,mBAAZC,SAAyB,CACzC,GAAIF,GAAWG,QAAQ,YACnBF,EAAIE,QAAQ,aAChBC,QAAOF,QAAUL,EAAQG,EAAUC,OAEnCJ,GAAQD,EAAKI,SAAUJ,EAAKK,KAG9BI,KAAM,SAASL,EAAUC,GACzB,YAEA,IAAIK,GAA6BN,EAASO,kBAiK1C,OAzJAP,GAASO,mBAAqB,SAAWP,EAAUC,GAKjD,GAAIO,GAAY,SAASC,GACvBJ,KAAKK,UACLL,KAAKM,iBACLN,KAAKO,kBACLP,KAAKQ,gBAELZ,EAAEa,KAAKL,EAAOJ,KAAKU,IAAKV,MAM1BJ,GAAEe,OAAOR,EAAUS,WAMjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAgBnB,OAbAhB,MAAKK,OAAOU,GAAWF,EAGnBA,EAAKI,QACPjB,KAAKM,cAAcO,EAAKI,MAAMD,KAAOD,GAInCD,IACFd,KAAKO,eAAeO,GAAeC,GAGrCf,KAAKQ,gBACER,MAKTkB,YAAa,SAASD,GACpB,MAAOjB,MAAKmB,eAAeF,EAAMD,MAMnCG,eAAgB,SAASC,GACvB,GAAIL,GAAUf,KAAKM,cAAcc,EACjC,OAAOpB,MAAKqB,UAAUN,IAIxBO,aAAc,SAASC,GACrB,GAAIR,GAAUf,KAAKO,eAAegB,EAClC,OAAOvB,MAAKqB,UAAUN,IAKxBS,YAAa,SAASD,GACpB,MAAO3B,GAAE6B,OAAOzB,KAAKK,QAAQkB,IAI/BF,UAAW,SAASL,GAClB,MAAOhB,MAAKK,OAAOW,IAIrBU,OAAQ,SAASb,GACf,GAAIE,GAAUF,EAAKG,GAoBnB,OAjBIH,GAAKI,aACAjB,MAAKM,cAAcO,EAAKI,MAAMD,KAIvCpB,EAAE+B,IAAI3B,KAAKO,eAAgB,SAASS,EAAKY,GACvC,MAAIZ,KAAQD,SACHf,MAAKO,eAAeqB,IACpB,GAFT,QAIC5B,YAGIA,MAAKK,OAAOU,GAGnBf,KAAKQ,gBACER,MAMT6B,KAAM,SAASC,GACb9B,KAAK+B,MAAMD,EAAQlC,EAAEoC,KAAKC,aAM5BF,MAAO,SAASD,EAAQI,GACtBtC,EAAEa,KAAKT,KAAKK,OAAQ,SAASQ,GACvBjB,EAAEuC,WAAWtB,EAAKiB,KACpBjB,EAAKiB,GAAQC,MAAMlB,EAAMqB,UAM/B1B,cAAe,WACbR,KAAKoC,OAASxC,EAAEyC,KAAKrC,KAAKK,UAS9B,IAAIiC,IAAW,UAAW,OAAQ,MAAO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAAS,SAWzC,OATA1C,GAAEa,KAAK6B,EAAS,SAASR,GACvB3B,EAAUS,UAAUkB,GAAU,WAC5B,GAAI1B,GAAQR,EAAE6B,OAAOzB,KAAKK,QACtB6B,GAAQ9B,GAAOmC,OAAO3C,EAAE4C,QAAQP,WACpC,OAAOrC,GAAEkC,GAAQC,MAAMnC,EAAGsC,MAKvB/B,GACNR,EAAUC,GAGbD,EAASO,mBAAmBuC,QAAU,SAEtC9C,EAASO,mBAAmBwC,WAAa,WAEvC,MADA/C,GAASO,mBAAqBD,EACvBD,MAGFL,EAASO","file":"lib/backbone.babysitter.min.js"}
|
||||||
12
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.min.js
vendored
Normal file
12
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.min.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// Backbone.BabySitter
|
||||||
|
// -------------------
|
||||||
|
// v0.1.11
|
||||||
|
//
|
||||||
|
// Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
|
||||||
|
// Distributed under MIT license
|
||||||
|
//
|
||||||
|
// http://github.com/marionettejs/backbone.babysitter
|
||||||
|
|
||||||
|
|
||||||
|
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";var c=a.ChildViewContainer;return a.ChildViewContainer=function(a,b){var c=function(a){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),b.each(a,this.add,this)};b.extend(c.prototype,{add:function(a,b){var c=a.cid;return this._views[c]=a,a.model&&(this._indexByModel[a.model.cid]=c),b&&(this._indexByCustom[b]=c),this._updateLength(),this},findByModel:function(a){return this.findByModelCid(a.cid)},findByModelCid:function(a){var b=this._indexByModel[a];return this.findByCid(b)},findByCustom:function(a){var b=this._indexByCustom[a];return this.findByCid(b)},findByIndex:function(a){return b.values(this._views)[a]},findByCid:function(a){return this._views[a]},remove:function(a){var c=a.cid;return a.model&&delete this._indexByModel[a.model.cid],b.any(this._indexByCustom,function(a,b){return a===c?(delete this._indexByCustom[b],!0):void 0},this),delete this._views[c],this._updateLength(),this},call:function(a){this.apply(a,b.tail(arguments))},apply:function(a,c){b.each(this._views,function(d){b.isFunction(d[a])&&d[a].apply(d,c||[])})},_updateLength:function(){this.length=b.size(this._views)}});var d=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"];return b.each(d,function(a){c.prototype[a]=function(){var c=b.values(this._views),d=[c].concat(b.toArray(arguments));return b[a].apply(b,d)}}),c}(a,b),a.ChildViewContainer.VERSION="0.1.11",a.ChildViewContainer.noConflict=function(){return a.ChildViewContainer=c,this},a.ChildViewContainer});
|
||||||
|
//# sourceMappingURL=backbone.babysitter.min.js.map
|
||||||
1
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.min.js.map
vendored
Normal file
1
docs/bower_components/backbone.babysitter/lib/backbone.babysitter.min.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["backbone.babysitter.js"],"names":["root","factory","define","amd","Backbone","_","exports","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict"],"mappings":";;;;;;;;;;CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAOJ,GAAQG,EAAUC,SAEtB,IAAuB,mBAAZC,SAAyB,CACzC,GAAIF,GAAWG,QAAQ,YACnBF,EAAIE,QAAQ,aAChBC,QAAOF,QAAUL,EAAQG,EAAUC,OAEnCJ,GAAQD,EAAKI,SAAUJ,EAAKK,IAG9BI,KAAM,SAASL,EAAUC,GACzB,YAEA,IAAIK,GAA6BN,EAASO,kBAiK1C,OAzJAP,GAASO,mBAAqB,SAAWP,EAAUC,GAKjD,GAAIO,GAAY,SAASC,GACvBJ,KAAKK,UACLL,KAAKM,iBACLN,KAAKO,kBACLP,KAAKQ,gBAELZ,EAAEa,KAAKL,EAAOJ,KAAKU,IAAKV,MAM1BJ,GAAEe,OAAOR,EAAUS,WAMjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAgBnB,OAbAhB,MAAKK,OAAOU,GAAWF,EAGnBA,EAAKI,QACPjB,KAAKM,cAAcO,EAAKI,MAAMD,KAAOD,GAInCD,IACFd,KAAKO,eAAeO,GAAeC,GAGrCf,KAAKQ,gBACER,MAKTkB,YAAa,SAASD,GACpB,MAAOjB,MAAKmB,eAAeF,EAAMD,MAMnCG,eAAgB,SAASC,GACvB,GAAIL,GAAUf,KAAKM,cAAcc,EACjC,OAAOpB,MAAKqB,UAAUN,IAIxBO,aAAc,SAASC,GACrB,GAAIR,GAAUf,KAAKO,eAAegB,EAClC,OAAOvB,MAAKqB,UAAUN,IAKxBS,YAAa,SAASD,GACpB,MAAO3B,GAAE6B,OAAOzB,KAAKK,QAAQkB,IAI/BF,UAAW,SAASL,GAClB,MAAOhB,MAAKK,OAAOW,IAIrBU,OAAQ,SAASb,GACf,GAAIE,GAAUF,EAAKG,GAoBnB,OAjBIH,GAAKI,aACAjB,MAAKM,cAAcO,EAAKI,MAAMD,KAIvCpB,EAAE+B,IAAI3B,KAAKO,eAAgB,SAASS,EAAKY,GACvC,MAAIZ,KAAQD,SACHf,MAAKO,eAAeqB,IACpB,GAFT,QAIC5B,YAGIA,MAAKK,OAAOU,GAGnBf,KAAKQ,gBACER,MAMT6B,KAAM,SAASC,GACb9B,KAAK+B,MAAMD,EAAQlC,EAAEoC,KAAKC,aAM5BF,MAAO,SAASD,EAAQI,GACtBtC,EAAEa,KAAKT,KAAKK,OAAQ,SAASQ,GACvBjB,EAAEuC,WAAWtB,EAAKiB,KACpBjB,EAAKiB,GAAQC,MAAMlB,EAAMqB,UAM/B1B,cAAe,WACbR,KAAKoC,OAASxC,EAAEyC,KAAKrC,KAAKK,UAS9B,IAAIiC,IAAW,UAAW,OAAQ,MAAO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAAS,SAWzC,OATA1C,GAAEa,KAAK6B,EAAS,SAASR,GACvB3B,EAAUS,UAAUkB,GAAU,WAC5B,GAAI1B,GAAQR,EAAE6B,OAAOzB,KAAKK,QACtB6B,GAAQ9B,GAAOmC,OAAO3C,EAAE4C,QAAQP,WACpC,OAAOrC,GAAEkC,GAAQC,MAAMnC,EAAGsC,MAKvB/B,GACNR,EAAUC,GAGbD,EAASO,mBAAmBuC,QAAU,SAEtC9C,EAASO,mBAAmBwC,WAAa,WAEvC,MADA/C,GAASO,mBAAqBD,EACvBD,MAGFL,EAASO","file":"backbone.babysitter.min.js"}
|
||||||
236
docs/bower_components/backbone.babysitter/readme.md
vendored
Normal file
236
docs/bower_components/backbone.babysitter/readme.md
vendored
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
# Backbone.BabySitter
|
||||||
|
|
||||||
|
[](https://travis-ci.org/marionettejs/backbone.babysitter)
|
||||||
|
|
||||||
|
Manage child views in a Backbone.View.
|
||||||
|
|
||||||
|
## About Backbone.BabySitter
|
||||||
|
|
||||||
|
Backbone provides a lot of functionality in its views, but does not directly
|
||||||
|
provide a way to manage child views or nested views. This is not terribly
|
||||||
|
difficult to do on your own, but it gets tedious to write the same code
|
||||||
|
over and over again.
|
||||||
|
|
||||||
|
Backbone.BabySitter provides a simple way to manage an unknown number of
|
||||||
|
child views within a Backbone.View, or other object that needs to track a
|
||||||
|
list of views.
|
||||||
|
|
||||||
|
## Downloads And Source
|
||||||
|
|
||||||
|
Grab the source from the `src` folder above. Grab the most recent builds
|
||||||
|
from the links below.
|
||||||
|
|
||||||
|
* Development: [backbone.babysitter.js](https://raw.github.com/marionettejs/backbone.babysitter/master/lib/backbone.babysitter.js)
|
||||||
|
|
||||||
|
* Production: [backbone.babysitter.min.js](https://raw.github.com/marionettejs/backbone.babysitter/master/lib/backbone.babysitter.min.js)
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Backbone.BabySitter exposes one constructor function: `Backbone.ChildViewContainer`.
|
||||||
|
This constructor function contains all of the necessary code for managing a list of
|
||||||
|
views.
|
||||||
|
|
||||||
|
### Storing Views
|
||||||
|
|
||||||
|
Views can be added to a container by calling the `add` method:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(someView);
|
||||||
|
container.add(anotherView);
|
||||||
|
```
|
||||||
|
|
||||||
|
Views will be stored once and indexed in several ways:
|
||||||
|
|
||||||
|
* by `view.cid`
|
||||||
|
* by `view.model.cid` if the view has a model
|
||||||
|
* by a custom index key
|
||||||
|
|
||||||
|
When adding a view, you can optionally specify a custom index key
|
||||||
|
by which you can later retrieve the view.
|
||||||
|
|
||||||
|
```js
|
||||||
|
container.add(aView, "an indexer");
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the custom indexer should be unique within the container. If you
|
||||||
|
add two different views with the same custom indexer, the last one in will
|
||||||
|
be the only one stored by that index key.
|
||||||
|
|
||||||
|
### Constructing With Views
|
||||||
|
|
||||||
|
An initial list of views can be added to the container through the
|
||||||
|
constructor function call. This list must be an array of view instances:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var views = [someView, anotherView];
|
||||||
|
var container = new Backbone.ChildViewContainer(views);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Retrieving Views
|
||||||
|
|
||||||
|
You can retrieve a view by any of the index:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(someView);
|
||||||
|
container.add(anotherView);
|
||||||
|
container.add(collectionView);
|
||||||
|
container.add(aView, "an indexer");
|
||||||
|
|
||||||
|
// find by view cid
|
||||||
|
var s = container.findByCid(someView.cid);
|
||||||
|
|
||||||
|
// find by model
|
||||||
|
var av = container.findByModel(anotherView.model);
|
||||||
|
|
||||||
|
// find by model cid
|
||||||
|
var av2 = container.findByModelCid(anotherView.model.cid);
|
||||||
|
|
||||||
|
// find by custom key
|
||||||
|
var custv = container.findByCustom("an indexer");
|
||||||
|
|
||||||
|
// find by numeric index (unstable)
|
||||||
|
var custv = container.findByIndex(0);
|
||||||
|
```
|
||||||
|
|
||||||
|
If the `findBy*` method cannot find the view, it will return undefined.
|
||||||
|
|
||||||
|
### Removing A View
|
||||||
|
|
||||||
|
You can remove a view directly and it will be removed from all available
|
||||||
|
indexes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(view);
|
||||||
|
|
||||||
|
// some time later
|
||||||
|
container.remove(view);
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove a view by an index, find it by that index and then remove
|
||||||
|
the resulting view.
|
||||||
|
|
||||||
|
### Executing Methods On All Views
|
||||||
|
|
||||||
|
You can execute any arbitrary method with any arbitrary parameters on all of
|
||||||
|
the views within the container. There are two ways to do this: `container.call`
|
||||||
|
and `container.apply`. These methods work similarly to `function.call` and
|
||||||
|
`function.apply` in how parameters are passed through. However, they do not
|
||||||
|
allow the context to be specified. The view on which a method is being called
|
||||||
|
will always be the context of the call.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var View = Backbone.View.extend({
|
||||||
|
doStuff: function(a, b){
|
||||||
|
},
|
||||||
|
|
||||||
|
moreStuff: function(a, b){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var v1 = new View();
|
||||||
|
var v2 = new View();
|
||||||
|
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(v1);
|
||||||
|
container.add(v2);
|
||||||
|
|
||||||
|
// call the doStuff function
|
||||||
|
container.call("doStuff", 1, 2);
|
||||||
|
|
||||||
|
// apply the doStuff function
|
||||||
|
container.apply("doStuff", [1, 2]);
|
||||||
|
```
|
||||||
|
|
||||||
|
If any given view within the container does not have the method specified, it
|
||||||
|
will not be called on that view. No errors will be thrown in this situation.
|
||||||
|
|
||||||
|
### Get The Number Of Stored Views
|
||||||
|
|
||||||
|
To get the number of stored views, call the `container.length`
|
||||||
|
attribute. This attribute is updated any time a view is added or
|
||||||
|
removed.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(view);
|
||||||
|
container.add(v2);
|
||||||
|
container.add(v3);
|
||||||
|
|
||||||
|
console.log(container.length); //=> 3
|
||||||
|
|
||||||
|
container.remove(v2);
|
||||||
|
|
||||||
|
console.log(container.length); //=> 2
|
||||||
|
```
|
||||||
|
|
||||||
|
### Iterators And Collection Functions
|
||||||
|
|
||||||
|
The container object borrows several functions from Underscore.js, to
|
||||||
|
provide iterators and other collection functions, including:
|
||||||
|
|
||||||
|
* forEach
|
||||||
|
* each
|
||||||
|
* map
|
||||||
|
* reduce
|
||||||
|
* find
|
||||||
|
* detect
|
||||||
|
* filter
|
||||||
|
* select
|
||||||
|
* reject
|
||||||
|
* every
|
||||||
|
* all
|
||||||
|
* some
|
||||||
|
* any
|
||||||
|
* include
|
||||||
|
* contains
|
||||||
|
* invoke
|
||||||
|
* toArray
|
||||||
|
* first
|
||||||
|
* initial
|
||||||
|
* rest
|
||||||
|
* last
|
||||||
|
* without
|
||||||
|
* isEmpty
|
||||||
|
* pluck
|
||||||
|
|
||||||
|
These methods can be called directly on the container, to iterate and
|
||||||
|
process the views held by the container.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(v1);
|
||||||
|
container.add(v2);
|
||||||
|
container.add(v3);
|
||||||
|
|
||||||
|
// iterate over all of the views
|
||||||
|
container.each(function(view){
|
||||||
|
|
||||||
|
// process each view individually, here
|
||||||
|
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information about these methods, see the [Underscore.js documentation](http://underscorejs.org).
|
||||||
|
|
||||||
|
## ChangeLog
|
||||||
|
|
||||||
|
For a complete change log, see the [CHANGELOG.md](https://github.com/marionettejs/backbone.babysitter/blob/master/CHANGELOG.md)
|
||||||
|
file.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT - see [LICENSE.md](https://github.com/marionettejs/backbone.babysitter/blob/master/LICENSE.md)
|
||||||
|
|
||||||
|
## Dev
|
||||||
|
|
||||||
|
* `npm install`
|
||||||
|
* `npm install -g grunt-cli`
|
||||||
|
* `grunt`
|
||||||
248
docs/bower_components/backbone.babysitter/spec/javascripts/childviewContainer.spec.js
vendored
Normal file
248
docs/bower_components/backbone.babysitter/spec/javascripts/childviewContainer.spec.js
vendored
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
describe("childview container", function(){
|
||||||
|
|
||||||
|
describe("when providing an array of views to the constructor", function(){
|
||||||
|
var container;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
var views = [
|
||||||
|
new Backbone.View(),
|
||||||
|
new Backbone.View(),
|
||||||
|
new Backbone.View()
|
||||||
|
]
|
||||||
|
container = new Backbone.ChildViewContainer(views);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should add all of the views", function(){
|
||||||
|
expect(container.length).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when adding a view that does not have a model to the container", function(){
|
||||||
|
var container, view, foundView, indexView;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
view = new Backbone.View();
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(view);
|
||||||
|
|
||||||
|
foundView = container.findByCid(view.cid);
|
||||||
|
indexView = container.findByIndex(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should make the view retrievable by the view's cid", function(){
|
||||||
|
expect(foundView).toBe(view);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should make the view retrievable by numeric index", function(){
|
||||||
|
expect(indexView).toBe(view);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should update the size of the chidren", function(){
|
||||||
|
expect(container.length).toBe(1);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when adding a view that has a model, to the container", function(){
|
||||||
|
var container, view, foundView, model;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
model = new Backbone.Model();
|
||||||
|
view = new Backbone.View({
|
||||||
|
model: model
|
||||||
|
});
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(view);
|
||||||
|
|
||||||
|
foundView = container.findByModel(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should make the view retrievable by the model", function(){
|
||||||
|
expect(foundView).toBe(view);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when adding a view with a custom index value", function(){
|
||||||
|
var container, view, foundView;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
view = new Backbone.View();
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
|
||||||
|
container.add(view, "custom indexer");
|
||||||
|
|
||||||
|
foundView = container.findByCustom("custom indexer");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should make the view retrievable by the custom indexer", function(){
|
||||||
|
expect(foundView).toBe(view);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when removing a view", function(){
|
||||||
|
var container, view, model, col, cust;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
model = new Backbone.Model();
|
||||||
|
cust = "custome indexer";
|
||||||
|
|
||||||
|
view = new Backbone.View({
|
||||||
|
model: model
|
||||||
|
});
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(view, cust);
|
||||||
|
|
||||||
|
container.remove(view);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should update the size of the chidren", function(){
|
||||||
|
expect(container.length).toBe(0);
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should remove the index by model", function(){
|
||||||
|
var v = container.findByModel(model);
|
||||||
|
expect(v).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should remove the index by custom", function(){
|
||||||
|
var v = container.findByCustom(cust);
|
||||||
|
expect(v).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should remove the view from the container", function(){
|
||||||
|
var v = container.findByCid(view.cid);
|
||||||
|
expect(v).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("adding or removing a view", function(){
|
||||||
|
var container, view, model;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
model = new Backbone.Model();
|
||||||
|
|
||||||
|
view = new Backbone.View({
|
||||||
|
model: model
|
||||||
|
});
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return itself when adding, for chaining methods", function(){
|
||||||
|
expect(container.add(view)).toBe(container);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return itself when removing, for chaining methods", function(){
|
||||||
|
expect(container.remove(view)).toBe(container);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when a container has 2 views in it", function(){
|
||||||
|
|
||||||
|
describe("and applying a method with parameters", function(){
|
||||||
|
var container, v1, v2;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
v1 = new Backbone.View();
|
||||||
|
v1.someFunc = jasmine.createSpy("some func");
|
||||||
|
|
||||||
|
v2 = new Backbone.View();
|
||||||
|
v2.someFunc = jasmine.createSpy("some func");
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(v1);
|
||||||
|
container.add(v2);
|
||||||
|
|
||||||
|
container.apply("someFunc", ["1", "2"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call that method on the first view", function(){
|
||||||
|
expect(v1.someFunc).toHaveBeenCalledWith("1", "2");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call that method on the second view", function(){
|
||||||
|
expect(v2.someFunc).toHaveBeenCalledWith("1", "2");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("and calling a method with parameters", function(){
|
||||||
|
var container, v1, v2;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
v1 = new Backbone.View();
|
||||||
|
v1.someFunc = jasmine.createSpy("some func");
|
||||||
|
|
||||||
|
v2 = new Backbone.View();
|
||||||
|
v2.someFunc = jasmine.createSpy("some func");
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(v1);
|
||||||
|
container.add(v2);
|
||||||
|
|
||||||
|
container.call("someFunc", "1", "2");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call that method on the first view", function(){
|
||||||
|
expect(v1.someFunc).toHaveBeenCalledWith("1", "2");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call that method on the second view", function(){
|
||||||
|
expect(v2.someFunc).toHaveBeenCalledWith("1", "2");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("and calling a method that doesn't exist on one of the views", function(){
|
||||||
|
var container, v1, v2;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
v1 = new Backbone.View();
|
||||||
|
|
||||||
|
v2 = new Backbone.View();
|
||||||
|
v2.someFunc = jasmine.createSpy("some func");
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(v1);
|
||||||
|
container.add(v2);
|
||||||
|
|
||||||
|
container.call("someFunc", "1", "2");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call that method on the second view", function(){
|
||||||
|
expect(v2.someFunc).toHaveBeenCalledWith("1", "2");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("iterators and collection functions", function(){
|
||||||
|
var container, view, views;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
views = [];
|
||||||
|
view = new Backbone.View();
|
||||||
|
|
||||||
|
container = new Backbone.ChildViewContainer();
|
||||||
|
container.add(view);
|
||||||
|
|
||||||
|
container.each(function(v, k){
|
||||||
|
views.push(v);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should provide a .each iterator", function(){
|
||||||
|
expect(_.isFunction(container.each)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should iterate the views with the .each function", function(){
|
||||||
|
expect(views[0]).toBe(view);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
8
docs/bower_components/backbone.babysitter/spec/javascripts/helpers/jasmineMatchers.js
vendored
Normal file
8
docs/bower_components/backbone.babysitter/spec/javascripts/helpers/jasmineMatchers.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
beforeEach(function() {
|
||||||
|
jasmine.addMatchers({
|
||||||
|
toHaveOwnProperty: function(expectedProperty) {
|
||||||
|
var obj = this.actual;
|
||||||
|
return obj.hasOwnProperty(expectedProperty);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
31
docs/bower_components/backbone.babysitter/src/build/backbone.babysitter.js
vendored
Normal file
31
docs/bower_components/backbone.babysitter/src/build/backbone.babysitter.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
(function(root, factory) {
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['backbone', 'underscore'], function(Backbone, _) {
|
||||||
|
return factory(Backbone, _);
|
||||||
|
});
|
||||||
|
} else if (typeof exports !== 'undefined') {
|
||||||
|
var Backbone = require('backbone');
|
||||||
|
var _ = require('underscore');
|
||||||
|
module.exports = factory(Backbone, _);
|
||||||
|
} else {
|
||||||
|
factory(root.Backbone, root._);
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this, function(Backbone, _) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var previousChildViewContainer = Backbone.ChildViewContainer;
|
||||||
|
|
||||||
|
// @include ../childviewcontainer.js
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer.VERSION = '<%= version %>';
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer.noConflict = function () {
|
||||||
|
Backbone.ChildViewContainer = previousChildViewContainer;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Backbone.ChildViewContainer;
|
||||||
|
|
||||||
|
}));
|
||||||
150
docs/bower_components/backbone.babysitter/src/childviewcontainer.js
vendored
Normal file
150
docs/bower_components/backbone.babysitter/src/childviewcontainer.js
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
// BabySitter.ChildViewContainer
|
||||||
|
// -----------------------------
|
||||||
|
//
|
||||||
|
// Provide a container to store, retrieve and
|
||||||
|
// shut down child views.
|
||||||
|
|
||||||
|
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||||
|
|
||||||
|
// Container Constructor
|
||||||
|
// ---------------------
|
||||||
|
|
||||||
|
var Container = function(views){
|
||||||
|
this._views = {};
|
||||||
|
this._indexByModel = {};
|
||||||
|
this._indexByCustom = {};
|
||||||
|
this._updateLength();
|
||||||
|
|
||||||
|
_.each(views, this.add, this);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Container Methods
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
_.extend(Container.prototype, {
|
||||||
|
|
||||||
|
// Add a view to this container. Stores the view
|
||||||
|
// by `cid` and makes it searchable by the model
|
||||||
|
// cid (and model itself). Optionally specify
|
||||||
|
// a custom key to store an retrieve the view.
|
||||||
|
add: function(view, customIndex){
|
||||||
|
var viewCid = view.cid;
|
||||||
|
|
||||||
|
// store the view
|
||||||
|
this._views[viewCid] = view;
|
||||||
|
|
||||||
|
// index it by model
|
||||||
|
if (view.model){
|
||||||
|
this._indexByModel[view.model.cid] = viewCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// index by custom
|
||||||
|
if (customIndex){
|
||||||
|
this._indexByCustom[customIndex] = viewCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._updateLength();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by the model that was attached to
|
||||||
|
// it. Uses the model's `cid` to find it.
|
||||||
|
findByModel: function(model){
|
||||||
|
return this.findByModelCid(model.cid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by the `cid` of the model that was attached to
|
||||||
|
// it. Uses the model's `cid` to find the view `cid` and
|
||||||
|
// retrieve the view using it.
|
||||||
|
findByModelCid: function(modelCid){
|
||||||
|
var viewCid = this._indexByModel[modelCid];
|
||||||
|
return this.findByCid(viewCid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find a view by a custom indexer.
|
||||||
|
findByCustom: function(index){
|
||||||
|
var viewCid = this._indexByCustom[index];
|
||||||
|
return this.findByCid(viewCid);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find by index. This is not guaranteed to be a
|
||||||
|
// stable index.
|
||||||
|
findByIndex: function(index){
|
||||||
|
return _.values(this._views)[index];
|
||||||
|
},
|
||||||
|
|
||||||
|
// retrieve a view by its `cid` directly
|
||||||
|
findByCid: function(cid){
|
||||||
|
return this._views[cid];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove a view
|
||||||
|
remove: function(view){
|
||||||
|
var viewCid = view.cid;
|
||||||
|
|
||||||
|
// delete model index
|
||||||
|
if (view.model){
|
||||||
|
delete this._indexByModel[view.model.cid];
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete custom index
|
||||||
|
_.any(this._indexByCustom, function(cid, key) {
|
||||||
|
if (cid === viewCid) {
|
||||||
|
delete this._indexByCustom[key];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// remove the view from the container
|
||||||
|
delete this._views[viewCid];
|
||||||
|
|
||||||
|
// update the length
|
||||||
|
this._updateLength();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Call a method on every view in the container,
|
||||||
|
// passing parameters to the call method one at a
|
||||||
|
// time, like `function.call`.
|
||||||
|
call: function(method){
|
||||||
|
this.apply(method, _.tail(arguments));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Apply a method on every view in the container,
|
||||||
|
// passing parameters to the call method one at a
|
||||||
|
// time, like `function.apply`.
|
||||||
|
apply: function(method, args){
|
||||||
|
_.each(this._views, function(view){
|
||||||
|
if (_.isFunction(view[method])){
|
||||||
|
view[method].apply(view, args || []);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Update the `.length` attribute on this container
|
||||||
|
_updateLength: function(){
|
||||||
|
this.length = _.size(this._views);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Borrowing this code from Backbone.Collection:
|
||||||
|
// http://backbonejs.org/docs/backbone.html#section-106
|
||||||
|
//
|
||||||
|
// Mix in methods from Underscore, for iteration, and other
|
||||||
|
// collection related features.
|
||||||
|
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||||
|
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||||
|
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||||
|
'last', 'without', 'isEmpty', 'pluck', 'reduce'];
|
||||||
|
|
||||||
|
_.each(methods, function(method) {
|
||||||
|
Container.prototype[method] = function() {
|
||||||
|
var views = _.values(this._views);
|
||||||
|
var args = [views].concat(_.toArray(arguments));
|
||||||
|
return _[method].apply(_, args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// return the public API
|
||||||
|
return Container;
|
||||||
|
})(Backbone, _);
|
||||||
53
docs/bower_components/backbone.marionette/.bower.json
vendored
Normal file
53
docs/bower_components/backbone.marionette/.bower.json
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.marionette",
|
||||||
|
"description": "Make your Backbone.js apps dance with a composite application architecture!",
|
||||||
|
"homepage": "http://marionettejs.org",
|
||||||
|
"main": "./lib/core/backbone.marionette.js",
|
||||||
|
"version": "2.4.7",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"framework",
|
||||||
|
"client",
|
||||||
|
"browser",
|
||||||
|
"composite"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "Derick Bailey",
|
||||||
|
"email": "derickbailey@gmail.com"
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"api",
|
||||||
|
"docs",
|
||||||
|
"jsdoc",
|
||||||
|
"src",
|
||||||
|
"tasks",
|
||||||
|
"test",
|
||||||
|
".editorconfig",
|
||||||
|
".gitignore",
|
||||||
|
".jscsrc",
|
||||||
|
".jshintrc",
|
||||||
|
".npmignore",
|
||||||
|
".travis.yml",
|
||||||
|
"component.json",
|
||||||
|
"CONTRIBUTING.md",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"SpecRunner.html",
|
||||||
|
"upgradeGuide.md"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3",
|
||||||
|
"backbone.babysitter": "^0.1.0",
|
||||||
|
"backbone.wreqr": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_release": "2.4.7",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v2.4.7",
|
||||||
|
"commit": "e1a512a2f44fadfebe5c01e8966bdbe4fa5f9e51"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/marionettejs/backbone.marionette.git",
|
||||||
|
"_target": "^2.4.6",
|
||||||
|
"_originalSource": "backbone.marionette"
|
||||||
|
}
|
||||||
21
docs/bower_components/backbone.marionette/ISSUE_TEMPLATE.md
vendored
Normal file
21
docs/bower_components/backbone.marionette/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
### Description
|
||||||
|
|
||||||
|
1. The problem you are facing (in as much detail as is necessary to describe the problem to someone who doesn't know anything about the system you're building)
|
||||||
|
2. A summary of the proposed solution
|
||||||
|
3. A description of how this solution solves the problem, in more detail than item #2
|
||||||
|
4. Any additional discussion on possible problems this might introduce, questions that you have related to the changes, etc.
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
Tell us what you think should happend.
|
||||||
|
|
||||||
|
### Actual behavior
|
||||||
|
|
||||||
|
If it is possible, please create a small demo that demonstrates the issue.
|
||||||
|
Please refrain from giving code examples in altJS languages like CoffeeScript, etc. Marionette is written in plain-old JavaScript and is generally easier for all members in the community to read.
|
||||||
|
|
||||||
|
### Environment
|
||||||
|
|
||||||
|
1. Marionette version:
|
||||||
|
2. Backbone version:
|
||||||
|
3. Additional build tools, etc:
|
||||||
6
docs/bower_components/backbone.marionette/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
6
docs/bower_components/backbone.marionette/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
### Proposed changes
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
|
||||||
|
Link to the issue:
|
||||||
44
docs/bower_components/backbone.marionette/bower.json
vendored
Normal file
44
docs/bower_components/backbone.marionette/bower.json
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.marionette",
|
||||||
|
"description": "Make your Backbone.js apps dance with a composite application architecture!",
|
||||||
|
"homepage": "http://marionettejs.org",
|
||||||
|
"main": "./lib/core/backbone.marionette.js",
|
||||||
|
"version": "2.4.7",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"framework",
|
||||||
|
"client",
|
||||||
|
"browser",
|
||||||
|
"composite"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "Derick Bailey",
|
||||||
|
"email": "derickbailey@gmail.com"
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"api",
|
||||||
|
"docs",
|
||||||
|
"jsdoc",
|
||||||
|
"src",
|
||||||
|
"tasks",
|
||||||
|
"test",
|
||||||
|
".editorconfig",
|
||||||
|
".gitignore",
|
||||||
|
".jscsrc",
|
||||||
|
".jshintrc",
|
||||||
|
".npmignore",
|
||||||
|
".travis.yml",
|
||||||
|
"component.json",
|
||||||
|
"CONTRIBUTING.md",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"SpecRunner.html",
|
||||||
|
"upgradeGuide.md"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3",
|
||||||
|
"backbone.babysitter": "^0.1.0",
|
||||||
|
"backbone.wreqr": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
1597
docs/bower_components/backbone.marionette/changelog.md
vendored
Normal file
1597
docs/bower_components/backbone.marionette/changelog.md
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3965
docs/bower_components/backbone.marionette/lib/backbone.marionette.js
vendored
Normal file
3965
docs/bower_components/backbone.marionette/lib/backbone.marionette.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
docs/bower_components/backbone.marionette/lib/backbone.marionette.min.js
vendored
Normal file
23
docs/bower_components/backbone.marionette/lib/backbone.marionette.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/backbone.marionette/lib/backbone.marionette.min.js.map
vendored
Normal file
1
docs/bower_components/backbone.marionette/lib/backbone.marionette.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3512
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.js
vendored
Normal file
3512
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.min.js
vendored
Normal file
3
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.min.js.map
vendored
Normal file
1
docs/bower_components/backbone.marionette/lib/core/backbone.marionette.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/backbone.marionette/license.txt
vendored
Normal file
1
docs/bower_components/backbone.marionette/license.txt
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
MarionetteJS is distributed under [MIT license](http://mutedsolutions.mit-license.org/).
|
||||||
BIN
docs/bower_components/backbone.marionette/marionette-logo.png
vendored
Normal file
BIN
docs/bower_components/backbone.marionette/marionette-logo.png
vendored
Normal file
Binary file not shown.
82
docs/bower_components/backbone.marionette/package.json
vendored
Normal file
82
docs/bower_components/backbone.marionette/package.json
vendored
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.marionette",
|
||||||
|
"description": "Make your Backbone.js apps dance!",
|
||||||
|
"version": "2.4.7",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.marionette",
|
||||||
|
"main": "lib/core/backbone.marionette.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"plugin",
|
||||||
|
"marionette",
|
||||||
|
"composite",
|
||||||
|
"architecture",
|
||||||
|
"single",
|
||||||
|
"page",
|
||||||
|
"app",
|
||||||
|
"client",
|
||||||
|
"browser"
|
||||||
|
],
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "MIT",
|
||||||
|
"url": "https://github.com/marionettejs/backbone.marionette/blob/master/license.txt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "grunt test --mocha-reporter=dot",
|
||||||
|
"coverage": "grunt coverage --mocha-reporter=dot"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Derick Bailey",
|
||||||
|
"email": "derickbailey@gmail.com",
|
||||||
|
"url": "http://derickbailey.lostechies.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/marionettejs/backbone.marionette/issues"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/marionettejs/backbone.marionette.git"
|
||||||
|
},
|
||||||
|
"github": "https://github.com/marionettejs/backbone.marionette",
|
||||||
|
"dependencies": {
|
||||||
|
"backbone.babysitter": "^0.1.0",
|
||||||
|
"backbone.wreqr": "^1.0.0",
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chai": "3.4.1",
|
||||||
|
"chai-jq": "0.0.9",
|
||||||
|
"chai-jquery": "2.0.0",
|
||||||
|
"dox": "git://github.com/jasonLaster/dox.git#marked",
|
||||||
|
"grunt": "0.4.5",
|
||||||
|
"grunt-cli": "0.1.13",
|
||||||
|
"grunt-contrib-clean": "0.7.0",
|
||||||
|
"grunt-contrib-concat": "0.5.1",
|
||||||
|
"grunt-contrib-connect": "0.11.2",
|
||||||
|
"grunt-contrib-jshint": "0.11.3",
|
||||||
|
"grunt-contrib-uglify": "1.0.1",
|
||||||
|
"grunt-contrib-watch": "0.6.1",
|
||||||
|
"grunt-coveralls": "1.0.0",
|
||||||
|
"grunt-env": "0.4.4",
|
||||||
|
"grunt-istanbul": "0.6.1",
|
||||||
|
"grunt-jscs": "2.6.0",
|
||||||
|
"grunt-lintspaces": "0.7.1",
|
||||||
|
"grunt-mocha-test": "0.12.7",
|
||||||
|
"grunt-plato": "1.2.1",
|
||||||
|
"grunt-preprocess": "5.0.1",
|
||||||
|
"grunt-template": "0.2.3",
|
||||||
|
"highlight.js": "9.1.0",
|
||||||
|
"jquery": "2.2.0",
|
||||||
|
"js-yaml": "3.5.2",
|
||||||
|
"jsdom": "3.1.2",
|
||||||
|
"load-grunt-tasks": "3.4.0",
|
||||||
|
"marked": "0.3",
|
||||||
|
"mocha": "2.3.4",
|
||||||
|
"sinon": "1.10.3",
|
||||||
|
"sinon-chai": "2.8.0",
|
||||||
|
"unwrap": "0.1.0",
|
||||||
|
"grunt-yaml-validate": "~0.1.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
144
docs/bower_components/backbone.marionette/readme.md
vendored
Normal file
144
docs/bower_components/backbone.marionette/readme.md
vendored
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<h1 align="center">Marionette.js</h1>
|
||||||
|
<p align="center">
|
||||||
|
<img title="backbone marionette" src='marionette-logo.png' />
|
||||||
|
</p>
|
||||||
|
<p align="center">The Backbone framework</p>
|
||||||
|
<p align="center">
|
||||||
|
<a title='Build Status' href="https://travis-ci.org/marionettejs/backbone.marionette">
|
||||||
|
<img src='https://secure.travis-ci.org/marionettejs/backbone.marionette.svg?branch=master' />
|
||||||
|
</a>
|
||||||
|
<a href='https://coveralls.io/r/marionettejs/backbone.marionette'>
|
||||||
|
<img src='https://img.shields.io/coveralls/marionettejs/backbone.marionette.svg' alt='Coverage Status' />
|
||||||
|
</a>
|
||||||
|
<a href='https://gitter.im/marionettejs/backbone.marionette?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge'>
|
||||||
|
<img src='https://badges.gitter.im/Join%20Chat.svg' alt='Gitter Chat' />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## About Marionette
|
||||||
|
|
||||||
|
Marionette is a composite application library for Backbone.js that
|
||||||
|
aims to simplify the construction of large scale JavaScript applications.
|
||||||
|
It is a collection of common design and implementation patterns found in
|
||||||
|
applications.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
All of the documentation for Marionette can be found at
|
||||||
|
|
||||||
|
##### [marionettejs.com/docs/current](http://marionettejs.com/docs/current)
|
||||||
|
|
||||||
|
### App Architecture On Backbone's Building Blocks
|
||||||
|
|
||||||
|
Backbone provides a great set of building blocks for our JavaScript
|
||||||
|
applications. It gives us the core constructs that are needed to build
|
||||||
|
small apps, organize jQuery DOM events, or create single page apps that
|
||||||
|
support mobile devices and large scale enterprise needs. But Backbone is
|
||||||
|
not a complete framework. It's a set of building blocks. It leaves
|
||||||
|
much of the application design, architecture and scalability to the
|
||||||
|
developer, including memory management, view management, and more.
|
||||||
|
|
||||||
|
Marionette brings an application architecture to Backbone, along with
|
||||||
|
built in view management and memory management. It's designed to be a
|
||||||
|
lightweight and flexible library of tools that sits on top of Backbone,
|
||||||
|
providing the framework for building a scalable application.
|
||||||
|
|
||||||
|
Like Backbone itself, you're not required to use all of Marionette just
|
||||||
|
because you want to use some of it. You can pick and choose which features
|
||||||
|
you want to use. This allows you to work with other Backbone
|
||||||
|
frameworks and plugins easily. It also means that you are not required
|
||||||
|
to engage in an all-or-nothing migration to begin using Marionette.
|
||||||
|
|
||||||
|
### Chat with us
|
||||||
|
|
||||||
|
Find us [on gitter](https://gitter.im/marionettejs/backbone.marionette) or on IRC in the FreeNode.net [#marionette channel](http://freenode.net).
|
||||||
|
|
||||||
|
We're happy to discuss design patterns and learn how you're using Marionette.
|
||||||
|
|
||||||
|
|
||||||
|
### Key Benefits
|
||||||
|
|
||||||
|
* Scalable: applications built in modules with event-driven architecture
|
||||||
|
* Sensible defaults: Underscore templates are used for view rendering
|
||||||
|
* Easily modifiable: works with the specific needs of your application
|
||||||
|
* Reduce boilerplate: for all views, including specialized types
|
||||||
|
* Create: application visuals at runtime with `Region` and `LayoutView` objects
|
||||||
|
* Nested: views and layouts within visual regions
|
||||||
|
* Built-in: memory management and zombie-killing for views, layoutViews and regions
|
||||||
|
* Event-driven architecture: utilizing the `Backbone.Wreqr.EventAggregator`
|
||||||
|
* Flexible: "as-needed" architecture allowing you to pick and choose what you need
|
||||||
|
* And much, much more
|
||||||
|
|
||||||
|
|
||||||
|
## Marionette Inspector
|
||||||
|
|
||||||
|
<a href="https://github.com/marionettejs/marionette.inspector"><img src="http://i.imgur.com/B1q9QXH.jpg" align="center" /></a>
|
||||||
|
|
||||||
|
+ **Visualize** the view hierarchy with the UI tree
|
||||||
|
+ **Visualize** application activity with a full history of actions
|
||||||
|
+ **Inspect** view ui, events, listeners, properties
|
||||||
|
+ **Inspect** model attributes, listeners, properties
|
||||||
|
+ **Explore** Radio channel events, requests, commands
|
||||||
|
+ **Explore** application with an inspector magnifying glass
|
||||||
|
+ **Jump** between the inspector elements and source panel with intelligent links
|
||||||
|
|
||||||
|
Download at [Chrome Web Store](https://chrome.google.com/webstore/detail/marionette-inspector/fbgfjlockdhidoaempmjcddibjklhpka)
|
||||||
|
Explore code at [Github](https://github.com/marionettejs/marionette.inspector)
|
||||||
|
|
||||||
|
## Source Code and Downloads
|
||||||
|
|
||||||
|
You can download the latest builds directly from the "lib" folder above.
|
||||||
|
For more information about the files in this folder, or to obtain an archive
|
||||||
|
containing all Marionette dependencies (including Underscore, Backbone, etc.),
|
||||||
|
please visit [the downloads section on the website](http://marionettejs.com#download).
|
||||||
|
|
||||||
|
#### [MarionetteJS.com](http://marionettejs.com#download)
|
||||||
|
|
||||||
|
### Available Packages
|
||||||
|
|
||||||
|
Marionette is available via bower, npm, and component.io. There are other channels that are maintained by the community.
|
||||||
|
|
||||||
|
|
||||||
|
## Release Notes And Upgrade Guide
|
||||||
|
|
||||||
|
**Changelog**: For change logs and release notes, see the
|
||||||
|
[changelog](changelog.md) file.
|
||||||
|
|
||||||
|
**Upgrade Guide**: Be sure to read [the upgrade guide](upgradeGuide.md)
|
||||||
|
for information on upgrading to the latest version of Marionette.
|
||||||
|
|
||||||
|
|
||||||
|
### Annotated Source Code
|
||||||
|
|
||||||
|
The source code for Marionette is heavily documented.
|
||||||
|
You can read the annotations for all the details of how Marionette works and advice on which methods to override.
|
||||||
|
|
||||||
|
##### [View the annotated source code](http://marionettejs.com/annotated-src/backbone.marionette)
|
||||||
|
|
||||||
|
## Compatibility and Requirements
|
||||||
|
|
||||||
|
MarionetteJS currently works with the following libraries:
|
||||||
|
|
||||||
|
* [jQuery](http://jquery.com) v1.8+
|
||||||
|
* [Underscore](http://underscorejs.org) v1.4.4 - 1.8.3
|
||||||
|
* [Backbone](http://backbonejs.org) v1.0.0 - 1.2.1 are preferred.
|
||||||
|
* [Backbone.Wreqr](https://github.com/marionettejs/backbone.wreqr) Comes automatically with the bundled build.
|
||||||
|
* [Backbone.BabySitter](https://github.com/marionettejs/backbone.babysitter) Comes automatically with the bundled build.
|
||||||
|
|
||||||
|
Marionette has not been tested against any other versions of these
|
||||||
|
libraries. You may or may not have success if you use a version other
|
||||||
|
than what is listed here.
|
||||||
|
|
||||||
|
|
||||||
|
## How to Contribute
|
||||||
|
|
||||||
|
If you would like to contribute to Marionette's source code, please read
|
||||||
|
the [guidelines for pull requests and contributions](CONTRIBUTING.md).
|
||||||
|
Following these guidelines will help make your contributions easier to
|
||||||
|
bring into the next release.
|
||||||
|
|
||||||
|
### [GitHub Issues](//github.com/marionettejs/backbone.marionette/issues)
|
||||||
|
|
||||||
|
Report issues with Marionette, submit pull requests to fix problems, or to
|
||||||
|
create summarized and documented feature requests (preferably with pull
|
||||||
|
requests that implement the feature).
|
||||||
42
docs/bower_components/backbone.radio/.bower.json
vendored
Normal file
42
docs/bower_components/backbone.radio/.bower.json
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.radio",
|
||||||
|
"version": "1.0.5",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.radio",
|
||||||
|
"authors": [
|
||||||
|
"Jmeas <jellyes2@gmail.com>"
|
||||||
|
],
|
||||||
|
"description": "Messaging patterns for Backbone applications.",
|
||||||
|
"main": "build/backbone.radio.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"marionette",
|
||||||
|
"decoupled",
|
||||||
|
"pubsub",
|
||||||
|
"publish",
|
||||||
|
"subscribe",
|
||||||
|
"messaging",
|
||||||
|
"architecture",
|
||||||
|
"spa"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3"
|
||||||
|
},
|
||||||
|
"_release": "1.0.5",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v1.0.5",
|
||||||
|
"commit": "277936bb207583b64bdc3b71f039bf170ea0a393"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/marionettejs/backbone.radio.git",
|
||||||
|
"_target": "^1.0.5",
|
||||||
|
"_originalSource": "backbone.radio"
|
||||||
|
}
|
||||||
119
docs/bower_components/backbone.radio/CHANGELOG.md
vendored
Normal file
119
docs/bower_components/backbone.radio/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
### [1.0.5](https://github.com/marionettejs/backbone.radio/releases/tag/1.0.5)
|
||||||
|
|
||||||
|
- Updated Backbone dep to allow v1.3.3
|
||||||
|
|
||||||
|
### [1.0.4](https://github.com/marionettejs/backbone.radio/releases/tag/1.0.4)
|
||||||
|
|
||||||
|
- **Bug fix**: The UMD generated from rollup was setting `global` to `undefined`.
|
||||||
|
|
||||||
|
### [1.0.3](https://github.com/marionettejs/backbone.radio/releases/tag/1.0.3)
|
||||||
|
|
||||||
|
- Updated Backbone dep to allow v1.3.2
|
||||||
|
|
||||||
|
### [1.0.2](https://github.com/marionettejs/backbone.radio/releases/tag/1.0.2)
|
||||||
|
|
||||||
|
- Updated Backbone dep to allow v1.2.3
|
||||||
|
|
||||||
|
### [1.0.1](https://github.com/marionettejs/backbone.radio/releases/tag/1.0.1)
|
||||||
|
|
||||||
|
- Updated Backbone dep to allow v1.2.2
|
||||||
|
|
||||||
|
### [1.0.0](https://github.com/jmeas/backbone.radio/releases/tag/v1.0.0)
|
||||||
|
|
||||||
|
- **Breaking change**: Commands have been removed. ([see explanation](https://github.com/marionettejs/backbone.radio/pull/221#issuecomment-104782925))
|
||||||
|
|
||||||
|
### [0.9.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.9.1)
|
||||||
|
|
||||||
|
- **Refactor**: Structure and build using babel-boilerplate
|
||||||
|
- Update Underscore and Backbone dependencies to 1.8.3 and 1.2.1 respectively to match Marionette.
|
||||||
|
|
||||||
|
### [0.9.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.9.0)
|
||||||
|
|
||||||
|
- **Breaking change**: Space-separated requests no longer return an Array. Instead, an Object is returned.
|
||||||
|
```js
|
||||||
|
// old
|
||||||
|
myChannel.request('thingOne thingTwo');
|
||||||
|
// => [replyOne, replyTwo]
|
||||||
|
|
||||||
|
// new
|
||||||
|
myChannel.request('thingOne thingTwo');
|
||||||
|
// => { thingOne: replyOne, thingTwo: replyTwo }
|
||||||
|
```
|
||||||
|
|
||||||
|
- **New feature**: `Radio.reset()` is now a top-level API method that can be used to reset a channel, or all channels. Do note that channels continue to have their own `reset` method.
|
||||||
|
- **New feature**: `Radio.debugLog()` is now exposed...go forth and customize how Radio logs potential errors!
|
||||||
|
|
||||||
|
### [0.8.2](https://github.com/jmeas/backbone.radio/releases/tag/v0.8.2)
|
||||||
|
|
||||||
|
- **Refactor**: A small refactor to support Underscore 1.4.4 (the lowest version that Marionette supports)
|
||||||
|
|
||||||
|
### [0.8.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.8.1)
|
||||||
|
|
||||||
|
- **Bug fix**: Fixes bug where `stopComplying` and `stopReplying` would not remove the correct
|
||||||
|
callbacks in certain situations
|
||||||
|
|
||||||
|
### [0.8.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.8.0)
|
||||||
|
|
||||||
|
- **Feature**: DEBUG now warns when an already-registered Command or Request is overwritten
|
||||||
|
- **Feature**: `stopComplying` and `stopReplying` now accept the same arguments as `off`
|
||||||
|
|
||||||
|
### [0.7.2](https://github.com/jmeas/backbone.radio/releases/tag/v0.7.2)
|
||||||
|
|
||||||
|
- Corrects Underscore dependency in bower.json.
|
||||||
|
|
||||||
|
### [0.7.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.7.1)
|
||||||
|
|
||||||
|
- Corrects Underscore dependency.
|
||||||
|
|
||||||
|
### [0.7.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.7.0)
|
||||||
|
|
||||||
|
- **Feature**: All API methods of Commands ands Requests now support the space-separated syntax.
|
||||||
|
- **Enhancement**: Only Channels created through Radio's factory method will register themselves on the internal
|
||||||
|
store of Channels
|
||||||
|
- **Enhancement**: Callback execution has been optimized
|
||||||
|
|
||||||
|
### [0.6.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.6.0)
|
||||||
|
|
||||||
|
*This update is not backwards compatible.*
|
||||||
|
|
||||||
|
- **Feature:** `channelName` is now a public property on each Channel.
|
||||||
|
- **Feature:** Requests and Commands can now have `"default"` handlers which will be called when the specified event isn't registered.
|
||||||
|
- **API Change:** The convenience connectX methods have been removed. In their place, the object syntax can be used for registering
|
||||||
|
multiple events on channels. This makes the API of Radio more consistent with Backbone.Events. For instance,
|
||||||
|
|
||||||
|
```js
|
||||||
|
myChannel.reply({
|
||||||
|
oneRequest: myCallback,
|
||||||
|
anotherRequest: myCallback
|
||||||
|
}, myContext);
|
||||||
|
```
|
||||||
|
|
||||||
|
### [0.5.2](https://github.com/jmeas/backbone.radio/releases/tag/v0.5.2)
|
||||||
|
|
||||||
|
- Fixes a bug where the top-level API would not pass the correct arguments to the underlying methods.
|
||||||
|
|
||||||
|
### [0.5.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.5.1)
|
||||||
|
|
||||||
|
- Fixes Radio.VERSION in the built library
|
||||||
|
|
||||||
|
### [0.5.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.5.0)
|
||||||
|
|
||||||
|
- Commands.react has been renamed to Commands.comply
|
||||||
|
|
||||||
|
### [0.4.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.4.1)
|
||||||
|
|
||||||
|
- The Channel convenience methods no longer bind the context, instead deferring that
|
||||||
|
responsibility to the wrapped methods themselves. This aids in stack traces and gives you
|
||||||
|
the ability to unregister the methods individually.
|
||||||
|
|
||||||
|
### [0.4.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.4.0)
|
||||||
|
|
||||||
|
- Debug mode now informs you when you attempt to unregister an event that was never registered. This is to help prevent memory leaks.
|
||||||
|
- `respond` has been renamed to `reply`
|
||||||
|
- More methods now return `this`, making the API more consistent internally, and with Backbone.Events
|
||||||
|
|
||||||
|
### [0.3.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.3.0)
|
||||||
|
|
||||||
|
- More test coverage
|
||||||
|
- Tests completely rewritten
|
||||||
|
- Numerous bug fixes; more work on the library
|
||||||
21
docs/bower_components/backbone.radio/LICENSE
vendored
Normal file
21
docs/bower_components/backbone.radio/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 James Smith
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
351
docs/bower_components/backbone.radio/README.md
vendored
Normal file
351
docs/bower_components/backbone.radio/README.md
vendored
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
# Backbone.Radio
|
||||||
|
|
||||||
|
[](https://travis-ci.org/marionettejs/backbone.radio)
|
||||||
|
[](https://codeclimate.com/github/marionettejs/backbone.radio)
|
||||||
|
[](https://david-dm.org/marionettejs/backbone.radio)
|
||||||
|
[](https://gitter.im/marionettejs/backbone.radio)
|
||||||
|
|
||||||
|
|
||||||
|
Backbone.Radio provides additional messaging patterns for Backbone applications.
|
||||||
|
|
||||||
|
Backbone includes an event system, Backbone.Events, which is an implementation of the publish-subscribe pattern. Pub-sub is by far the most
|
||||||
|
common event pattern in client-side applications, and for good reason: it is incredibly useful. It should also be familiar to web developers
|
||||||
|
in particular, because the DOM relies heavily on pub-sub. Consider, for instance, registering a handler on an element's `click` event. This isn't
|
||||||
|
so much different than listening to a Model's `change` event, as both of these situations are using pub-sub.
|
||||||
|
|
||||||
|
Backbone.Radio adds two additional messaging-related features. The first is Requests, an implementation of the request-reply pattern. Request-reply
|
||||||
|
should also be familiar to web developers, as it's the messaging pattern that backs HTTP communications. The other feature are Channels: explicit
|
||||||
|
namespaces to your communications.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Clone this repository or install via [Bower](http://bower.io/) or [npm](https://www.npmjs.org/).
|
||||||
|
|
||||||
|
```
|
||||||
|
bower install backbone.radio
|
||||||
|
npm install backbone.radio
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
- [Backbone.Events](#backboneevents)
|
||||||
|
- [Radio.Requests](#backboneradiorequests)
|
||||||
|
- [Channels](#channels)
|
||||||
|
- [Using With Marionette](#using-with-marionette)
|
||||||
|
- [API](#api)
|
||||||
|
- [Radio.Requests](#requests)
|
||||||
|
- [Channel](#channel)
|
||||||
|
- [Radio](#radio)
|
||||||
|
- [Top-level API](#top-level-api)
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Backbone.Events
|
||||||
|
|
||||||
|
Anyone who has used Backbone should be quite familiar with Backbone.Events. Backbone.Events is what facilitates
|
||||||
|
communications between objects in your application. The quintessential example of this is listening in on a
|
||||||
|
Model's change event.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Listen in on a model's change events
|
||||||
|
this.listenTo(someModel, 'change', myCallback);
|
||||||
|
|
||||||
|
// Later on, the model triggers a change event when it has been changed
|
||||||
|
someModel.trigger('change');
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's look at a diagram for Backbone.Events:
|
||||||
|
|
||||||
|
<p align='center'>
|
||||||
|
<img src='https://cloud.githubusercontent.com/assets/10248067/11762943/5a927e54-a0bd-11e5-8aa5-e0fafae0e559.png' alt='Backbone.Events diagram'>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
It goes without saying that Backbone.Events is incredibly useful when you mix it into instances of Classes. But what
|
||||||
|
if you had a standalone Object with an instance of Backbone.Events on it? This gives you a powerful message bus to utilize.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Create a message bus
|
||||||
|
var myBus = _.extend({}, Backbone.Events);
|
||||||
|
|
||||||
|
// Listen in on the message bus
|
||||||
|
this.listenTo(myBus, 'some:event', myCallback);
|
||||||
|
|
||||||
|
// Trigger an event on the bus
|
||||||
|
myBus.trigger('some:event');
|
||||||
|
```
|
||||||
|
|
||||||
|
As long as there was an easy way to access this message bus throughout your entire application, then you would have a central
|
||||||
|
place to store a collection of events. This is the idea behind Channels. But before we go more into that, let's take a look at Requests.
|
||||||
|
|
||||||
|
### Backbone.Radio.Requests
|
||||||
|
|
||||||
|
Requests is similar to Events in that it's another event system. And it has a similar API, too. For this reason, you *could* mix
|
||||||
|
it into an object.
|
||||||
|
|
||||||
|
```js
|
||||||
|
_.extend(myView, Backbone.Radio.Requests);
|
||||||
|
```
|
||||||
|
|
||||||
|
Although this works, I wouldn't recommend it. Requests are most useful, I think, when they're used with a Channel.
|
||||||
|
|
||||||
|
Perhaps the biggest difference between Events and Requests is that Requests have *intention*. Unlike Events, which notify
|
||||||
|
nothing in particular about an occurrence, Requests are asking for a very specific thing to occur. As a consequence of this,
|
||||||
|
requests are 'one-to-one,' which means that you cannot have multiple 'listeners' to a single request.
|
||||||
|
|
||||||
|
Let's look at a basic example.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Set up an object to reply to a request. In this case, whether or not its visible.
|
||||||
|
myObject.reply('visible', this.isVisible);
|
||||||
|
|
||||||
|
// Get whether it's visible or not.
|
||||||
|
var isViewVisible = myObject.request('visible');
|
||||||
|
```
|
||||||
|
|
||||||
|
The handler in `reply` can either return a flat value, like `true` or `false`, or a function to be executed. Either way, the value is sent back to
|
||||||
|
the requester.
|
||||||
|
|
||||||
|
Here's a diagram of the Requests pattern:
|
||||||
|
|
||||||
|
<p align='center'>
|
||||||
|
<img src='https://cloud.githubusercontent.com/assets/10248067/11762945/5c302a36-a0bd-11e5-8e4e-0eee7cacbef1.png' alt='Backbone.Requests diagram'>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Although the name is 'Requests,' you can just as easily request information as you can request that an action be completed. Just like HTTP,
|
||||||
|
where you can both make GET requests for information, or DELETE requests to order than a resource be deleted, Requests can be used for a variety
|
||||||
|
of purposes.
|
||||||
|
|
||||||
|
One thing to note is that this pattern is **identical** to a simple method call. One can just as easily rewrite the above example as:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Set up a method...
|
||||||
|
myObject.isVisible = function() {
|
||||||
|
return this.viewIsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call that method
|
||||||
|
var isViewVisible = myObject.isVisible();
|
||||||
|
```
|
||||||
|
|
||||||
|
This is why mixing Requests into something like a View or Model does not make much sense. If you have access to the View or Model, then
|
||||||
|
you might as well just use methods.
|
||||||
|
|
||||||
|
### Channels
|
||||||
|
|
||||||
|
The real draw of Backbone.Radio are Channels. A Channel is simply an object that has Backbone.Events and Radio.Requests mixed into it:
|
||||||
|
it's a standalone message bus comprised of both systems.
|
||||||
|
|
||||||
|
Getting a handle of a Channel is easy.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Get a reference to the channel named 'user'
|
||||||
|
var userChannel = Backbone.Radio.channel('user');
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you've got a channel, you can attach handlers to it.
|
||||||
|
|
||||||
|
```js
|
||||||
|
userChannel.on('some:event', function() {
|
||||||
|
console.log('An event has happened!');
|
||||||
|
});
|
||||||
|
|
||||||
|
userChannel.reply('some:request', 'food is good');
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the 'trigger' methods on the Channel.
|
||||||
|
|
||||||
|
```js
|
||||||
|
userChannel.trigger('some:event');
|
||||||
|
|
||||||
|
userChannel.request('some:request');
|
||||||
|
```
|
||||||
|
|
||||||
|
You can have as many channels as you'd like
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Maybe you have a channel for the profile section of your app
|
||||||
|
var profileChannel = Backbone.Radio.channel('profile');
|
||||||
|
|
||||||
|
// And another one for settings
|
||||||
|
var settingsChannel = Backbone.Radio.channel('settings');
|
||||||
|
```
|
||||||
|
|
||||||
|
The whole point of Channels is that they provide a way to explicitly namespace events in your application, and a means to easily access
|
||||||
|
any of those namespaces.
|
||||||
|
|
||||||
|
### Using With Marionette
|
||||||
|
|
||||||
|
[Marionette](https://github.com/marionettejs/backbone.marionette) does not use Radio by default, although it will in the next major release: v3. However, you can use Radio today by including a small shim after you load Marionette, but before you load your application's code. To get the shim, refer to [this Gist](https://gist.github.com/jmeas/7992474cdb1c5672d88b).
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Like Backbone.Events, **all** of the following methods support both the object-syntax and space-separated syntax. For the sake of brevity,
|
||||||
|
I only provide examples for these alternate syntaxes in the most common use cases.
|
||||||
|
|
||||||
|
### Requests
|
||||||
|
|
||||||
|
#### `request( requestName [, args...] )`
|
||||||
|
|
||||||
|
Make a request for `requestName`. Optionally pass arguments to send along to the callback. Returns the reply, if one
|
||||||
|
exists. If there is no reply registered then `undefined` will be returned.
|
||||||
|
|
||||||
|
You can make multiple requests at once by using the space-separated syntax.
|
||||||
|
|
||||||
|
```js
|
||||||
|
myChannel.request('requestOne requestTwo');
|
||||||
|
```
|
||||||
|
|
||||||
|
When using the space-separated syntax, the responses will be returned to you as an object, where
|
||||||
|
the keys are the name of the request, and the values are the replies.
|
||||||
|
|
||||||
|
#### `reply( requestName, callback [, context] )`
|
||||||
|
|
||||||
|
Register a handler for `requestName` on this object. `callback` will be executed whenever the request is made. Optionally
|
||||||
|
pass a `context` for the callback, defaulting to `this`.
|
||||||
|
|
||||||
|
To register a default handler for Requests use the `default` requestName. The unhandled `requestName` will be passed as the first argument.
|
||||||
|
|
||||||
|
```js
|
||||||
|
myChannel.reply('default', function(requestName) {
|
||||||
|
console.log('No reply exists for this request: ' + requestName);
|
||||||
|
});
|
||||||
|
|
||||||
|
// This will be handled by the default request
|
||||||
|
myChannel.request('someUnhandledRequest');
|
||||||
|
```
|
||||||
|
|
||||||
|
To register multiple requests at once you may also pass in a hash.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Connect all of the replies at once
|
||||||
|
myChannel.reply({
|
||||||
|
'some:request': myCallback,
|
||||||
|
'some:other:request': someOtherCallback
|
||||||
|
}, context);
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the instance of Requests.
|
||||||
|
|
||||||
|
#### `replyOnce( requestName, callback [, context] )`
|
||||||
|
|
||||||
|
Register a handler for `requestName` that will only be called a single time.
|
||||||
|
|
||||||
|
Like `reply`, you may also pass a hash of replies to register many at once. Refer to the `reply` documentation above
|
||||||
|
for an example.
|
||||||
|
|
||||||
|
Returns the instance of Requests.
|
||||||
|
|
||||||
|
#### `stopReplying( [requestName] [, callback] [, context] )`
|
||||||
|
|
||||||
|
If `context` is passed, then all replies with that context will be removed from the object. If `callback` is
|
||||||
|
passed then all requests with that callback will be removed. If `requestName` is passed then this method will
|
||||||
|
remove that reply. If no arguments are passed then all replies are removed from the object.
|
||||||
|
|
||||||
|
You may also pass a hash of replies or space-separated replies to remove many at once.
|
||||||
|
|
||||||
|
Returns the instance of Requests.
|
||||||
|
|
||||||
|
### Channel
|
||||||
|
|
||||||
|
#### `channelName`
|
||||||
|
|
||||||
|
The name of the channel.
|
||||||
|
|
||||||
|
#### `reset()`
|
||||||
|
|
||||||
|
Destroy all handlers from Backbone.Events and Radio.Requests from the channel. Returns the channel.
|
||||||
|
|
||||||
|
### Radio
|
||||||
|
|
||||||
|
#### `channel( channelName )`
|
||||||
|
|
||||||
|
Get a reference to a channel by name. If a name is not provided an Error will be thrown.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var authChannel = Backbone.Radio.channel('auth');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `DEBUG`
|
||||||
|
|
||||||
|
This is a Boolean property. Setting it to `true` will cause console warnings to be issued
|
||||||
|
whenever you interact with a `request` that isn't registered. This is useful in development when you want to
|
||||||
|
ensure that you've got your event names in order.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Turn on debug mode
|
||||||
|
Backbone.Radio.DEBUG = true;
|
||||||
|
|
||||||
|
// This will log a warning to the console if it goes unhandled
|
||||||
|
myChannel.request('show:view');
|
||||||
|
|
||||||
|
// Likewise, this will too, helping to prevent memory leaks
|
||||||
|
myChannel.stopReplying('startTime');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `debugLog(warning, eventName, channelName)`
|
||||||
|
|
||||||
|
A function executed whenever an unregistered request is interacted with on a Channel. Only
|
||||||
|
called when `DEBUG` is set to `true`. By overriding this you could, for instance, make unhandled
|
||||||
|
events throw Errors.
|
||||||
|
|
||||||
|
The warning is a string describing the type of problem, such as:
|
||||||
|
|
||||||
|
> Attempted to remove the unregistered request
|
||||||
|
|
||||||
|
while the `eventName` and `channelName` are what you would expect.
|
||||||
|
|
||||||
|
#### `tuneIn( channelName )`
|
||||||
|
|
||||||
|
Tuning into a Channel is another useful tool for debugging. It passes all
|
||||||
|
triggers and requests made on the channel to
|
||||||
|
|
||||||
|
[`Radio.log`](https://github.com/jmeas/backbone.radio#log-channelname-eventname--args-).
|
||||||
|
Returns `Backbone.Radio`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
Backbone.Radio.tuneIn('calendar');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tuneOut( channelName )`
|
||||||
|
|
||||||
|
Once you're done tuning in you can call `tuneOut` to stop the logging. Returns `Backbone.Radio`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
Backbone.Radio.tuneOut('calendar');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `log( channelName, eventName [, args...] )`
|
||||||
|
|
||||||
|
When tuned into a Channel, this method will be called for all activity on
|
||||||
|
a channel. The default implementation is to `console.log` the following message:
|
||||||
|
|
||||||
|
```js
|
||||||
|
'[channelName] "eventName" args1 arg2 arg3...'
|
||||||
|
```
|
||||||
|
|
||||||
|
where args are all of the arguments passed with the message. It is exposed so that you
|
||||||
|
may overwrite it with your own logging message if you wish.
|
||||||
|
|
||||||
|
### 'Top-level' API
|
||||||
|
|
||||||
|
If you'd like to execute a method on a channel, yet you don't need to keep a handle of the
|
||||||
|
channel around, you can do so with the proxy functions directly on the `Backbone.Radio` object.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Trigger 'some:event' on the settings channel
|
||||||
|
Backbone.Radio.trigger('settings', 'some:event');
|
||||||
|
```
|
||||||
|
|
||||||
|
All of the methods for both messaging systems are available from the top-level API.
|
||||||
|
|
||||||
|
#### `reset( [channelName] )`
|
||||||
|
|
||||||
|
You can also reset a single channel, or all Channels, from the `Radio` object directly. Pass a
|
||||||
|
`channelName` to reset just that specific channel, or call the method without any arguments
|
||||||
|
to reset every channel.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Reset all channels
|
||||||
|
Radio.reset();
|
||||||
|
```
|
||||||
33
docs/bower_components/backbone.radio/bower.json
vendored
Normal file
33
docs/bower_components/backbone.radio/bower.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.radio",
|
||||||
|
"version": "1.0.4",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.radio",
|
||||||
|
"authors": [
|
||||||
|
"Jmeas <jellyes2@gmail.com>"
|
||||||
|
],
|
||||||
|
"description": "Messaging patterns for Backbone applications.",
|
||||||
|
"main": "build/backbone.radio.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"marionette",
|
||||||
|
"decoupled",
|
||||||
|
"pubsub",
|
||||||
|
"publish",
|
||||||
|
"subscribe",
|
||||||
|
"messaging",
|
||||||
|
"architecture",
|
||||||
|
"spa"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
352
docs/bower_components/backbone.radio/build/backbone.radio.js
vendored
Normal file
352
docs/bower_components/backbone.radio/build/backbone.radio.js
vendored
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
// Backbone.Radio v1.0.4
|
||||||
|
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('underscore'), require('backbone')) :
|
||||||
|
typeof define === 'function' && define.amd ? define(['underscore', 'backbone'], factory) :
|
||||||
|
(global.Backbone = global.Backbone || {}, global.Backbone.Radio = factory(global._,global.Backbone));
|
||||||
|
}(this, function (_,Backbone) { 'use strict';
|
||||||
|
|
||||||
|
_ = 'default' in _ ? _['default'] : _;
|
||||||
|
Backbone = 'default' in Backbone ? Backbone['default'] : Backbone;
|
||||||
|
|
||||||
|
var babelHelpers = {};
|
||||||
|
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||||
|
return typeof obj;
|
||||||
|
} : function (obj) {
|
||||||
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
||||||
|
};
|
||||||
|
babelHelpers;
|
||||||
|
|
||||||
|
var previousRadio = Backbone.Radio;
|
||||||
|
|
||||||
|
var Radio = Backbone.Radio = {};
|
||||||
|
|
||||||
|
Radio.VERSION = '1.0.4';
|
||||||
|
|
||||||
|
// This allows you to run multiple instances of Radio on the same
|
||||||
|
// webapp. After loading the new version, call `noConflict()` to
|
||||||
|
// get a reference to it. At the same time the old version will be
|
||||||
|
// returned to Backbone.Radio.
|
||||||
|
Radio.noConflict = function () {
|
||||||
|
Backbone.Radio = previousRadio;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Whether or not we're in DEBUG mode or not. DEBUG mode helps you
|
||||||
|
// get around the issues of lack of warnings when events are mis-typed.
|
||||||
|
Radio.DEBUG = false;
|
||||||
|
|
||||||
|
// Format debug text.
|
||||||
|
Radio._debugText = function (warning, eventName, channelName) {
|
||||||
|
return warning + (channelName ? ' on the ' + channelName + ' channel' : '') + ': "' + eventName + '"';
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the method that's called when an unregistered event was called.
|
||||||
|
// By default, it logs warning to the console. By overriding this you could
|
||||||
|
// make it throw an Error, for instance. This would make firing a nonexistent event
|
||||||
|
// have the same consequence as firing a nonexistent method on an Object.
|
||||||
|
Radio.debugLog = function (warning, eventName, channelName) {
|
||||||
|
if (Radio.DEBUG && console && console.warn) {
|
||||||
|
console.warn(Radio._debugText(warning, eventName, channelName));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var eventSplitter = /\s+/;
|
||||||
|
|
||||||
|
// An internal method used to handle Radio's method overloading for Requests.
|
||||||
|
// It's borrowed from Backbone.Events. It differs from Backbone's overload
|
||||||
|
// API (which is used in Backbone.Events) in that it doesn't support space-separated
|
||||||
|
// event names.
|
||||||
|
Radio._eventsApi = function (obj, action, name, rest) {
|
||||||
|
if (!name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = {};
|
||||||
|
|
||||||
|
// Handle event maps.
|
||||||
|
if ((typeof name === 'undefined' ? 'undefined' : babelHelpers.typeof(name)) === 'object') {
|
||||||
|
for (var key in name) {
|
||||||
|
var result = obj[action].apply(obj, [key, name[key]].concat(rest));
|
||||||
|
eventSplitter.test(key) ? _.extend(results, result) : results[key] = result;
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle space separated event names.
|
||||||
|
if (eventSplitter.test(name)) {
|
||||||
|
var names = name.split(eventSplitter);
|
||||||
|
for (var i = 0, l = names.length; i < l; i++) {
|
||||||
|
results[names[i]] = obj[action].apply(obj, [names[i]].concat(rest));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// An optimized way to execute callbacks.
|
||||||
|
Radio._callHandler = function (callback, context, args) {
|
||||||
|
var a1 = args[0],
|
||||||
|
a2 = args[1],
|
||||||
|
a3 = args[2];
|
||||||
|
switch (args.length) {
|
||||||
|
case 0:
|
||||||
|
return callback.call(context);
|
||||||
|
case 1:
|
||||||
|
return callback.call(context, a1);
|
||||||
|
case 2:
|
||||||
|
return callback.call(context, a1, a2);
|
||||||
|
case 3:
|
||||||
|
return callback.call(context, a1, a2, a3);
|
||||||
|
default:
|
||||||
|
return callback.apply(context, args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// A helper used by `off` methods to the handler from the store
|
||||||
|
function removeHandler(store, name, callback, context) {
|
||||||
|
var event = store[name];
|
||||||
|
if ((!callback || callback === event.callback || callback === event.callback._callback) && (!context || context === event.context)) {
|
||||||
|
delete store[name];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeHandlers(store, name, callback, context) {
|
||||||
|
store || (store = {});
|
||||||
|
var names = name ? [name] : _.keys(store);
|
||||||
|
var matched = false;
|
||||||
|
|
||||||
|
for (var i = 0, length = names.length; i < length; i++) {
|
||||||
|
name = names[i];
|
||||||
|
|
||||||
|
// If there's no event by this name, log it and continue
|
||||||
|
// with the loop
|
||||||
|
if (!store[name]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeHandler(store, name, callback, context)) {
|
||||||
|
matched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tune-in
|
||||||
|
* -------
|
||||||
|
* Get console logs of a channel's activity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var _logs = {};
|
||||||
|
|
||||||
|
// This is to produce an identical function in both tuneIn and tuneOut,
|
||||||
|
// so that Backbone.Events unregisters it.
|
||||||
|
function _partial(channelName) {
|
||||||
|
return _logs[channelName] || (_logs[channelName] = _.bind(Radio.log, Radio, channelName));
|
||||||
|
}
|
||||||
|
|
||||||
|
_.extend(Radio, {
|
||||||
|
|
||||||
|
// Log information about the channel and event
|
||||||
|
log: function log(channelName, eventName) {
|
||||||
|
if (typeof console === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var args = _.toArray(arguments).slice(2);
|
||||||
|
console.log('[' + channelName + '] "' + eventName + '"', args);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Logs all events on this channel to the console. It sets an
|
||||||
|
// internal value on the channel telling it we're listening,
|
||||||
|
// then sets a listener on the Backbone.Events
|
||||||
|
tuneIn: function tuneIn(channelName) {
|
||||||
|
var channel = Radio.channel(channelName);
|
||||||
|
channel._tunedIn = true;
|
||||||
|
channel.on('all', _partial(channelName));
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Stop logging all of the activities on this channel to the console
|
||||||
|
tuneOut: function tuneOut(channelName) {
|
||||||
|
var channel = Radio.channel(channelName);
|
||||||
|
channel._tunedIn = false;
|
||||||
|
channel.off('all', _partial(channelName));
|
||||||
|
delete _logs[channelName];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.Requests
|
||||||
|
* -----------------------
|
||||||
|
* A messaging system for requesting data.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function makeCallback(callback) {
|
||||||
|
return _.isFunction(callback) ? callback : function () {
|
||||||
|
return callback;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Radio.Requests = {
|
||||||
|
|
||||||
|
// Make a request
|
||||||
|
request: function request(name) {
|
||||||
|
var args = _.toArray(arguments).slice(1);
|
||||||
|
var results = Radio._eventsApi(this, 'request', name, args);
|
||||||
|
if (results) {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
var channelName = this.channelName;
|
||||||
|
var requests = this._requests;
|
||||||
|
|
||||||
|
// Check if we should log the request, and if so, do it
|
||||||
|
if (channelName && this._tunedIn) {
|
||||||
|
Radio.log.apply(this, [channelName, name].concat(args));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the request isn't handled, log it in DEBUG mode and exit
|
||||||
|
if (requests && (requests[name] || requests['default'])) {
|
||||||
|
var handler = requests[name] || requests['default'];
|
||||||
|
args = requests[name] ? args : arguments;
|
||||||
|
return Radio._callHandler(handler.callback, handler.context, args);
|
||||||
|
} else {
|
||||||
|
Radio.debugLog('An unhandled request was fired', name, channelName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set up a handler for a request
|
||||||
|
reply: function reply(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'reply', name, [callback, context])) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._requests || (this._requests = {});
|
||||||
|
|
||||||
|
if (this._requests[name]) {
|
||||||
|
Radio.debugLog('A request was overwritten', name, this.channelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._requests[name] = {
|
||||||
|
callback: makeCallback(callback),
|
||||||
|
context: context || this
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set up a handler that can only be requested once
|
||||||
|
replyOnce: function replyOnce(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'replyOnce', name, [callback, context])) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
var once = _.once(function () {
|
||||||
|
self.stopReplying(name);
|
||||||
|
return makeCallback(callback).apply(this, arguments);
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.reply(name, once, context);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove handler(s)
|
||||||
|
stopReplying: function stopReplying(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'stopReplying', name)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove everything if there are no arguments passed
|
||||||
|
if (!name && !callback && !context) {
|
||||||
|
delete this._requests;
|
||||||
|
} else if (!removeHandlers(this._requests, name, callback, context)) {
|
||||||
|
Radio.debugLog('Attempted to remove the unregistered request', name, this.channelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.channel
|
||||||
|
* ----------------------
|
||||||
|
* Get a reference to a channel by name.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Radio._channels = {};
|
||||||
|
|
||||||
|
Radio.channel = function (channelName) {
|
||||||
|
if (!channelName) {
|
||||||
|
throw new Error('You must provide a name for the channel.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Radio._channels[channelName]) {
|
||||||
|
return Radio._channels[channelName];
|
||||||
|
} else {
|
||||||
|
return Radio._channels[channelName] = new Radio.Channel(channelName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.Channel
|
||||||
|
* ----------------------
|
||||||
|
* A Channel is an object that extends from Backbone.Events,
|
||||||
|
* and Radio.Requests.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Radio.Channel = function (channelName) {
|
||||||
|
this.channelName = channelName;
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Radio.Channel.prototype, Backbone.Events, Radio.Requests, {
|
||||||
|
|
||||||
|
// Remove all handlers from the messaging systems of this channel
|
||||||
|
reset: function reset() {
|
||||||
|
this.off();
|
||||||
|
this.stopListening();
|
||||||
|
this.stopReplying();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Top-level API
|
||||||
|
* -------------
|
||||||
|
* Supplies the 'top-level API' for working with Channels directly
|
||||||
|
* from Backbone.Radio.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var channel;
|
||||||
|
var args;
|
||||||
|
var systems = [Backbone.Events, Radio.Requests];
|
||||||
|
_.each(systems, function (system) {
|
||||||
|
_.each(system, function (method, methodName) {
|
||||||
|
Radio[methodName] = function (channelName) {
|
||||||
|
args = _.toArray(arguments).slice(1);
|
||||||
|
channel = this.channel(channelName);
|
||||||
|
return channel[methodName].apply(channel, args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Radio.reset = function (channelName) {
|
||||||
|
var channels = !channelName ? this._channels : [this._channels[channelName]];
|
||||||
|
_.each(channels, function (channel) {
|
||||||
|
channel.reset();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return Radio;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=./backbone.radio.js.map
|
||||||
1
docs/bower_components/backbone.radio/build/backbone.radio.js.map
vendored
Normal file
1
docs/bower_components/backbone.radio/build/backbone.radio.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
docs/bower_components/backbone.radio/build/backbone.radio.min.js
vendored
Normal file
3
docs/bower_components/backbone.radio/build/backbone.radio.min.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Backbone.Radio v1.0.4
|
||||||
|
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["underscore","backbone"],n):(e.Backbone=e.Backbone||{},e.Backbone.Radio=n(e._,e.Backbone))}(this,function(e,n){"use strict";function t(e,n,t,r){var o=e[n];return t&&t!==o.callback&&t!==o.callback._callback||r&&r!==o.context?void 0:(delete e[n],!0)}function r(n,r,o,i){n||(n={});for(var s=r?[r]:e.keys(n),u=!1,a=0,c=s.length;c>a;a++)r=s[a],n[r]&&t(n,r,o,i)&&(u=!0);return u}function o(n){return l[n]||(l[n]=e.bind(a.log,a,n))}function i(n){return e.isFunction(n)?n:function(){return n}}e="default"in e?e["default"]:e,n="default"in n?n["default"]:n;var s={};s["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var u=n.Radio,a=n.Radio={};a.VERSION="1.0.4",a.noConflict=function(){return n.Radio=u,this},a.DEBUG=!1,a._debugText=function(e,n,t){return e+(t?" on the "+t+" channel":"")+': "'+n+'"'},a.debugLog=function(e,n,t){a.DEBUG&&console&&console.warn&&console.warn(a._debugText(e,n,t))};var c=/\s+/;a._eventsApi=function(n,t,r,o){if(!r)return!1;var i={};if("object"===("undefined"==typeof r?"undefined":s["typeof"](r))){for(var u in r){var a=n[t].apply(n,[u,r[u]].concat(o));c.test(u)?e.extend(i,a):i[u]=a}return i}if(c.test(r)){for(var l=r.split(c),f=0,h=l.length;h>f;f++)i[l[f]]=n[t].apply(n,[l[f]].concat(o));return i}return!1},a._callHandler=function(e,n,t){var r=t[0],o=t[1],i=t[2];switch(t.length){case 0:return e.call(n);case 1:return e.call(n,r);case 2:return e.call(n,r,o);case 3:return e.call(n,r,o,i);default:return e.apply(n,t)}};var l={};e.extend(a,{log:function(n,t){if("undefined"!=typeof console){var r=e.toArray(arguments).slice(2);console.log("["+n+'] "'+t+'"',r)}},tuneIn:function(e){var n=a.channel(e);return n._tunedIn=!0,n.on("all",o(e)),this},tuneOut:function(e){var n=a.channel(e);return n._tunedIn=!1,n.off("all",o(e)),delete l[e],this}}),a.Requests={request:function(n){var t=e.toArray(arguments).slice(1),r=a._eventsApi(this,"request",n,t);if(r)return r;var o=this.channelName,i=this._requests;if(o&&this._tunedIn&&a.log.apply(this,[o,n].concat(t)),i&&(i[n]||i["default"])){var s=i[n]||i["default"];return t=i[n]?t:arguments,a._callHandler(s.callback,s.context,t)}a.debugLog("An unhandled request was fired",n,o)},reply:function(e,n,t){return a._eventsApi(this,"reply",e,[n,t])?this:(this._requests||(this._requests={}),this._requests[e]&&a.debugLog("A request was overwritten",e,this.channelName),this._requests[e]={callback:i(n),context:t||this},this)},replyOnce:function(n,t,r){if(a._eventsApi(this,"replyOnce",n,[t,r]))return this;var o=this,s=e.once(function(){return o.stopReplying(n),i(t).apply(this,arguments)});return this.reply(n,s,r)},stopReplying:function(e,n,t){return a._eventsApi(this,"stopReplying",e)?this:(e||n||t?r(this._requests,e,n,t)||a.debugLog("Attempted to remove the unregistered request",e,this.channelName):delete this._requests,this)}},a._channels={},a.channel=function(e){if(!e)throw new Error("You must provide a name for the channel.");return a._channels[e]?a._channels[e]:a._channels[e]=new a.Channel(e)},a.Channel=function(e){this.channelName=e},e.extend(a.Channel.prototype,n.Events,a.Requests,{reset:function(){return this.off(),this.stopListening(),this.stopReplying(),this}});var f,h,d=[n.Events,a.Requests];return e.each(d,function(n){e.each(n,function(n,t){a[t]=function(n){return h=e.toArray(arguments).slice(1),f=this.channel(n),f[t].apply(f,h)}})}),a.reset=function(n){var t=n?[this._channels[n]]:this._channels;e.each(t,function(e){e.reset()})},a});
|
||||||
|
//# sourceMappingURL=backbone.radio.min.js.map
|
||||||
2
docs/bower_components/backbone.radio/build/backbone.radio.min.js.map
vendored
Normal file
2
docs/bower_components/backbone.radio/build/backbone.radio.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
233
docs/bower_components/backbone.radio/gulpfile.babel.js
vendored
Normal file
233
docs/bower_components/backbone.radio/gulpfile.babel.js
vendored
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
import gulp from 'gulp';
|
||||||
|
import loadPlugins from 'gulp-load-plugins';
|
||||||
|
import del from 'del';
|
||||||
|
import glob from 'glob';
|
||||||
|
import path from 'path';
|
||||||
|
import {Instrumenter} from 'isparta';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import webpackStream from 'webpack-stream';
|
||||||
|
|
||||||
|
import _ from 'underscore';
|
||||||
|
import rollup from 'rollup';
|
||||||
|
import babel from 'rollup-plugin-babel';
|
||||||
|
import preset from 'babel-preset-es2015-rollup';
|
||||||
|
import fs from 'fs';
|
||||||
|
import mkdirp from 'mkdirp';
|
||||||
|
|
||||||
|
import mochaGlobals from './test/setup/.globals';
|
||||||
|
import manifest from './package.json';
|
||||||
|
|
||||||
|
// Load all of our Gulp plugins
|
||||||
|
const $ = loadPlugins();
|
||||||
|
|
||||||
|
// Gather the library data from `package.json`
|
||||||
|
const config = manifest.babelBoilerplateOptions;
|
||||||
|
const mainFile = manifest.main;
|
||||||
|
const destinationFolder = path.dirname(mainFile);
|
||||||
|
const exportFileName = path.basename(mainFile, path.extname(mainFile));
|
||||||
|
|
||||||
|
function cleanDist(done) {
|
||||||
|
del([destinationFolder]).then(() => done());
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanTmp(done) {
|
||||||
|
del(['tmp']).then(() => done());
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError() {
|
||||||
|
$.util.beep();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lint a set of files
|
||||||
|
function lint(files) {
|
||||||
|
return gulp.src(files)
|
||||||
|
.pipe($.plumber())
|
||||||
|
.pipe($.eslint())
|
||||||
|
.pipe($.eslint.format())
|
||||||
|
.pipe($.eslint.failOnError())
|
||||||
|
.pipe($.jscs())
|
||||||
|
.pipe($.jscs.reporter())
|
||||||
|
.pipe($.jscs.reporter('fail'))
|
||||||
|
.on('error', onError);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lintSrc() {
|
||||||
|
return lint('src/**/*.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
function lintTest() {
|
||||||
|
return lint('test/**/*.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
function lintGulpfile() {
|
||||||
|
return lint('gulpfile.babel.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBanner() {
|
||||||
|
var banner = '// Backbone.Radio v<%= version %>\n';
|
||||||
|
return _.template(banner)(manifest);
|
||||||
|
}
|
||||||
|
|
||||||
|
function build(done) {
|
||||||
|
rollup.rollup({
|
||||||
|
entry: path.join('src', config.entryFileName),
|
||||||
|
plugins: [
|
||||||
|
babel({
|
||||||
|
sourceMaps: true,
|
||||||
|
presets: [preset],
|
||||||
|
babelrc: false
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}).then(function(bundle) {
|
||||||
|
var banner = getBanner();
|
||||||
|
|
||||||
|
var result = bundle.generate({
|
||||||
|
banner: banner,
|
||||||
|
format: 'umd',
|
||||||
|
sourceMap: 'inline',
|
||||||
|
sourceMapSource: config.entryFileName + '.js',
|
||||||
|
sourceMapFile: exportFileName + '.js',
|
||||||
|
moduleName: config.mainVarName
|
||||||
|
});
|
||||||
|
var code = _.template(result.code.toString())(manifest) +
|
||||||
|
`\n//# sourceMappingURL=./${exportFileName}.js.map`;
|
||||||
|
|
||||||
|
// Write the generated sourcemap
|
||||||
|
mkdirp.sync(destinationFolder);
|
||||||
|
fs.writeFileSync(path.join(destinationFolder, exportFileName + '.js'), code);
|
||||||
|
fs.writeFileSync(path.join(destinationFolder, `${exportFileName}.js.map`), result.map.toString());
|
||||||
|
|
||||||
|
$.file(exportFileName + '.js', code, { src: true })
|
||||||
|
.pipe($.plumber())
|
||||||
|
.pipe($.sourcemaps.init({ loadMaps: true }))
|
||||||
|
.pipe($.sourcemaps.write('./', {addComment: false}))
|
||||||
|
.pipe(gulp.dest(destinationFolder))
|
||||||
|
.pipe($.filter(['*', '!**/*.js.map']))
|
||||||
|
.pipe($.rename(exportFileName + '.min.js'))
|
||||||
|
.pipe($.sourcemaps.init({ loadMaps: true }))
|
||||||
|
.pipe($.uglify())
|
||||||
|
.pipe($.sourcemaps.write('./'))
|
||||||
|
.pipe($.header(banner))
|
||||||
|
.pipe(gulp.dest(destinationFolder))
|
||||||
|
.on('end', done);
|
||||||
|
}).catch(console.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _mocha() {
|
||||||
|
return gulp.src(['test/setup/node.js', 'test/unit/**/*.js'], {read: false})
|
||||||
|
.pipe($.mocha({
|
||||||
|
reporter: 'dot',
|
||||||
|
globals: Object.keys(mochaGlobals.globals),
|
||||||
|
ignoreLeaks: false
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function _registerBabel() {
|
||||||
|
require('babel-register');
|
||||||
|
}
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
_registerBabel();
|
||||||
|
return _mocha();
|
||||||
|
}
|
||||||
|
|
||||||
|
function coverage(done) {
|
||||||
|
_registerBabel();
|
||||||
|
gulp.src(['src/**/*.js'])
|
||||||
|
.pipe($.istanbul({ instrumenter: Instrumenter }))
|
||||||
|
.pipe($.istanbul.hookRequire())
|
||||||
|
.on('finish', () => {
|
||||||
|
return test()
|
||||||
|
.pipe($.istanbul.writeReports())
|
||||||
|
.on('end', done);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const watchFiles = ['src/**/*', 'test/**/*', 'package.json', '**/.eslintrc', '.jscsrc'];
|
||||||
|
|
||||||
|
// Run the headless unit tests as you make changes.
|
||||||
|
function watch() {
|
||||||
|
gulp.watch(watchFiles, ['test']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testBrowser() {
|
||||||
|
// Our testing bundle is made up of our unit tests, which
|
||||||
|
// should individually load up pieces of our application.
|
||||||
|
// We also include the browser setup file.
|
||||||
|
const testFiles = glob.sync('./test/unit/**/*.js');
|
||||||
|
const allFiles = ['./test/setup/browser.js'].concat(testFiles);
|
||||||
|
|
||||||
|
// Lets us differentiate between the first build and subsequent builds
|
||||||
|
var firstBuild = true;
|
||||||
|
|
||||||
|
// This empty stream might seem like a hack, but we need to specify all of our files through
|
||||||
|
// the `entry` option of webpack. Otherwise, it ignores whatever file(s) are placed in here.
|
||||||
|
return gulp.src('')
|
||||||
|
.pipe($.plumber())
|
||||||
|
.pipe(webpackStream({
|
||||||
|
watch: true,
|
||||||
|
entry: allFiles,
|
||||||
|
output: {
|
||||||
|
filename: '__spec-build.js'
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
// This is what allows us to author in future JavaScript
|
||||||
|
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
|
||||||
|
// This allows the test setup scripts to load `package.json`
|
||||||
|
{ test: /\.json$/, exclude: /node_modules/, loader: 'json-loader' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// By default, webpack does `n=>n` compilation with entry files. This concatenates
|
||||||
|
// them into a single chunk.
|
||||||
|
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 })
|
||||||
|
],
|
||||||
|
devtool: 'inline-source-map'
|
||||||
|
}, null, function() {
|
||||||
|
if (firstBuild) {
|
||||||
|
$.livereload.listen({port: 35729, host: 'localhost', start: true});
|
||||||
|
var watcher = gulp.watch(watchFiles, ['lint']);
|
||||||
|
} else {
|
||||||
|
$.livereload.reload('./tmp/__spec-build.js');
|
||||||
|
}
|
||||||
|
firstBuild = false;
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('./tmp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the built files
|
||||||
|
gulp.task('clean', cleanDist);
|
||||||
|
|
||||||
|
// Remove our temporary files
|
||||||
|
gulp.task('clean-tmp', cleanTmp);
|
||||||
|
|
||||||
|
// Lint our source code
|
||||||
|
gulp.task('lint-src', lintSrc);
|
||||||
|
|
||||||
|
// Lint our test code
|
||||||
|
gulp.task('lint-test', lintTest);
|
||||||
|
|
||||||
|
// Lint this file
|
||||||
|
gulp.task('lint-gulpfile', lintGulpfile);
|
||||||
|
|
||||||
|
// Lint everything
|
||||||
|
gulp.task('lint', ['lint-src', 'lint-test', 'lint-gulpfile']);
|
||||||
|
|
||||||
|
// Build two versions of the library
|
||||||
|
gulp.task('build', ['lint', 'clean'], build);
|
||||||
|
|
||||||
|
// Lint and run our tests
|
||||||
|
gulp.task('test', ['lint'], test);
|
||||||
|
|
||||||
|
// Set up coverage and run tests
|
||||||
|
gulp.task('coverage', ['lint'], coverage);
|
||||||
|
|
||||||
|
// Set up a livereload environment for our spec runner `test/runner.html`
|
||||||
|
gulp.task('test-browser', ['lint', 'clean-tmp'], testBrowser);
|
||||||
|
|
||||||
|
// Run the headless unit tests as you make changes.
|
||||||
|
gulp.task('watch', watch);
|
||||||
|
|
||||||
|
// An alias of test
|
||||||
|
gulp.task('default', ['test']);
|
||||||
88
docs/bower_components/backbone.radio/package.json
vendored
Normal file
88
docs/bower_components/backbone.radio/package.json
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.radio",
|
||||||
|
"description": "Messaging patterns for Backbone applications.",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.radio",
|
||||||
|
"version": "1.0.4",
|
||||||
|
"main": "build/backbone.radio.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"marionette",
|
||||||
|
"decoupled",
|
||||||
|
"pubsub",
|
||||||
|
"publish",
|
||||||
|
"subscribe",
|
||||||
|
"messaging",
|
||||||
|
"architecture",
|
||||||
|
"spa"
|
||||||
|
],
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "MIT",
|
||||||
|
"url": "https://github.com/marionettejs/backbone.radio/blob/master/LICENSE"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "gulp",
|
||||||
|
"test-browser": "gulp test-browser",
|
||||||
|
"build": "gulp build",
|
||||||
|
"coverage": "gulp coverage"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Jmeas",
|
||||||
|
"email": "jellyes2@gmail.com",
|
||||||
|
"web": "http://jmeas.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/marionettejs/backbone.radio/issues"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/marionettejs/backbone.radio.git"
|
||||||
|
},
|
||||||
|
"github": "https://github.com/marionettejs/backbone.radio",
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": "1.0.0 - 1.3.x",
|
||||||
|
"underscore": "1.4.4 - 1.8.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.3.26",
|
||||||
|
"babel-eslint": "^4.1.6",
|
||||||
|
"babel-loader": "^6.2.0",
|
||||||
|
"babel-polyfill": "^6.3.14",
|
||||||
|
"babel-preset-es2015": "^6.3.13",
|
||||||
|
"babel-preset-es2015-rollup": "^1.1.1",
|
||||||
|
"babel-register": "^6.3.13",
|
||||||
|
"chai": "^3.4.1",
|
||||||
|
"del": "^2.2.0",
|
||||||
|
"glob": "^6.0.3",
|
||||||
|
"gulp": "^3.9.0",
|
||||||
|
"gulp-eslint": "^1.1.1",
|
||||||
|
"gulp-file": "^0.2.0",
|
||||||
|
"gulp-filter": "^3.0.0",
|
||||||
|
"gulp-header": "^1.7.1",
|
||||||
|
"gulp-istanbul": "^0.10.3",
|
||||||
|
"gulp-jscs": "^3.0.0",
|
||||||
|
"gulp-livereload": "^3.8.1",
|
||||||
|
"gulp-load-plugins": "^1.1.0",
|
||||||
|
"gulp-mocha": "^2.2.0",
|
||||||
|
"gulp-plumber": "^1.0.1",
|
||||||
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
|
"gulp-uglify": "^1.5.1",
|
||||||
|
"gulp-util": "^3.0.7",
|
||||||
|
"isparta": "^4.0.0",
|
||||||
|
"json-loader": "^0.5.3",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"mocha": "^2.3.4",
|
||||||
|
"rollup": "^0.25.4",
|
||||||
|
"rollup-plugin-babel": "^2.4.0",
|
||||||
|
"sinon": "^1.17.2",
|
||||||
|
"sinon-chai": "^2.8.0",
|
||||||
|
"webpack": "^1.12.9",
|
||||||
|
"webpack-stream": "^3.1.0"
|
||||||
|
},
|
||||||
|
"babelBoilerplateOptions": {
|
||||||
|
"entryFileName": "backbone.radio",
|
||||||
|
"mainVarName": "Backbone.Radio"
|
||||||
|
}
|
||||||
|
}
|
||||||
323
docs/bower_components/backbone.radio/src/backbone.radio.js
vendored
Normal file
323
docs/bower_components/backbone.radio/src/backbone.radio.js
vendored
Normal file
@@ -0,0 +1,323 @@
|
|||||||
|
import _ from 'underscore';
|
||||||
|
import Backbone from 'backbone';
|
||||||
|
|
||||||
|
var previousRadio = Backbone.Radio;
|
||||||
|
|
||||||
|
var Radio = Backbone.Radio = {};
|
||||||
|
|
||||||
|
Radio.VERSION = '<%= version %>';
|
||||||
|
|
||||||
|
// This allows you to run multiple instances of Radio on the same
|
||||||
|
// webapp. After loading the new version, call `noConflict()` to
|
||||||
|
// get a reference to it. At the same time the old version will be
|
||||||
|
// returned to Backbone.Radio.
|
||||||
|
Radio.noConflict = function() {
|
||||||
|
Backbone.Radio = previousRadio;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Whether or not we're in DEBUG mode or not. DEBUG mode helps you
|
||||||
|
// get around the issues of lack of warnings when events are mis-typed.
|
||||||
|
Radio.DEBUG = false;
|
||||||
|
|
||||||
|
// Format debug text.
|
||||||
|
Radio._debugText = function(warning, eventName, channelName) {
|
||||||
|
return warning + (channelName ? ' on the ' + channelName + ' channel' : '') +
|
||||||
|
': "' + eventName + '"';
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the method that's called when an unregistered event was called.
|
||||||
|
// By default, it logs warning to the console. By overriding this you could
|
||||||
|
// make it throw an Error, for instance. This would make firing a nonexistent event
|
||||||
|
// have the same consequence as firing a nonexistent method on an Object.
|
||||||
|
Radio.debugLog = function(warning, eventName, channelName) {
|
||||||
|
if (Radio.DEBUG && console && console.warn) {
|
||||||
|
console.warn(Radio._debugText(warning, eventName, channelName));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var eventSplitter = /\s+/;
|
||||||
|
|
||||||
|
// An internal method used to handle Radio's method overloading for Requests.
|
||||||
|
// It's borrowed from Backbone.Events. It differs from Backbone's overload
|
||||||
|
// API (which is used in Backbone.Events) in that it doesn't support space-separated
|
||||||
|
// event names.
|
||||||
|
Radio._eventsApi = function(obj, action, name, rest) {
|
||||||
|
if (!name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = {};
|
||||||
|
|
||||||
|
// Handle event maps.
|
||||||
|
if (typeof name === 'object') {
|
||||||
|
for (var key in name) {
|
||||||
|
var result = obj[action].apply(obj, [key, name[key]].concat(rest));
|
||||||
|
eventSplitter.test(key) ? _.extend(results, result) : results[key] = result;
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle space separated event names.
|
||||||
|
if (eventSplitter.test(name)) {
|
||||||
|
var names = name.split(eventSplitter);
|
||||||
|
for (var i = 0, l = names.length; i < l; i++) {
|
||||||
|
results[names[i]] = obj[action].apply(obj, [names[i]].concat(rest));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// An optimized way to execute callbacks.
|
||||||
|
Radio._callHandler = function(callback, context, args) {
|
||||||
|
var a1 = args[0], a2 = args[1], a3 = args[2];
|
||||||
|
switch (args.length) {
|
||||||
|
case 0: return callback.call(context);
|
||||||
|
case 1: return callback.call(context, a1);
|
||||||
|
case 2: return callback.call(context, a1, a2);
|
||||||
|
case 3: return callback.call(context, a1, a2, a3);
|
||||||
|
default: return callback.apply(context, args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// A helper used by `off` methods to the handler from the store
|
||||||
|
function removeHandler(store, name, callback, context) {
|
||||||
|
var event = store[name];
|
||||||
|
if (
|
||||||
|
(!callback || (callback === event.callback || callback === event.callback._callback)) &&
|
||||||
|
(!context || (context === event.context))
|
||||||
|
) {
|
||||||
|
delete store[name];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeHandlers(store, name, callback, context) {
|
||||||
|
store || (store = {});
|
||||||
|
var names = name ? [name] : _.keys(store);
|
||||||
|
var matched = false;
|
||||||
|
|
||||||
|
for (var i = 0, length = names.length; i < length; i++) {
|
||||||
|
name = names[i];
|
||||||
|
|
||||||
|
// If there's no event by this name, log it and continue
|
||||||
|
// with the loop
|
||||||
|
if (!store[name]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeHandler(store, name, callback, context)) {
|
||||||
|
matched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tune-in
|
||||||
|
* -------
|
||||||
|
* Get console logs of a channel's activity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var _logs = {};
|
||||||
|
|
||||||
|
// This is to produce an identical function in both tuneIn and tuneOut,
|
||||||
|
// so that Backbone.Events unregisters it.
|
||||||
|
function _partial(channelName) {
|
||||||
|
return _logs[channelName] || (_logs[channelName] = _.bind(Radio.log, Radio, channelName));
|
||||||
|
}
|
||||||
|
|
||||||
|
_.extend(Radio, {
|
||||||
|
|
||||||
|
// Log information about the channel and event
|
||||||
|
log: function(channelName, eventName) {
|
||||||
|
if (typeof console === 'undefined') { return; }
|
||||||
|
var args = _.toArray(arguments).slice(2);
|
||||||
|
console.log('[' + channelName + '] "' + eventName + '"', args);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Logs all events on this channel to the console. It sets an
|
||||||
|
// internal value on the channel telling it we're listening,
|
||||||
|
// then sets a listener on the Backbone.Events
|
||||||
|
tuneIn: function(channelName) {
|
||||||
|
var channel = Radio.channel(channelName);
|
||||||
|
channel._tunedIn = true;
|
||||||
|
channel.on('all', _partial(channelName));
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Stop logging all of the activities on this channel to the console
|
||||||
|
tuneOut: function(channelName) {
|
||||||
|
var channel = Radio.channel(channelName);
|
||||||
|
channel._tunedIn = false;
|
||||||
|
channel.off('all', _partial(channelName));
|
||||||
|
delete _logs[channelName];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.Requests
|
||||||
|
* -----------------------
|
||||||
|
* A messaging system for requesting data.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function makeCallback(callback) {
|
||||||
|
return _.isFunction(callback) ? callback : function() { return callback; };
|
||||||
|
}
|
||||||
|
|
||||||
|
Radio.Requests = {
|
||||||
|
|
||||||
|
// Make a request
|
||||||
|
request: function(name) {
|
||||||
|
var args = _.toArray(arguments).slice(1);
|
||||||
|
var results = Radio._eventsApi(this, 'request', name, args);
|
||||||
|
if (results) {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
var channelName = this.channelName;
|
||||||
|
var requests = this._requests;
|
||||||
|
|
||||||
|
// Check if we should log the request, and if so, do it
|
||||||
|
if (channelName && this._tunedIn) {
|
||||||
|
Radio.log.apply(this, [channelName, name].concat(args));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the request isn't handled, log it in DEBUG mode and exit
|
||||||
|
if (requests && (requests[name] || requests['default'])) {
|
||||||
|
var handler = requests[name] || requests['default'];
|
||||||
|
args = requests[name] ? args : arguments;
|
||||||
|
return Radio._callHandler(handler.callback, handler.context, args);
|
||||||
|
} else {
|
||||||
|
Radio.debugLog('An unhandled request was fired', name, channelName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set up a handler for a request
|
||||||
|
reply: function(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'reply', name, [callback, context])) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._requests || (this._requests = {});
|
||||||
|
|
||||||
|
if (this._requests[name]) {
|
||||||
|
Radio.debugLog('A request was overwritten', name, this.channelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._requests[name] = {
|
||||||
|
callback: makeCallback(callback),
|
||||||
|
context: context || this
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set up a handler that can only be requested once
|
||||||
|
replyOnce: function(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'replyOnce', name, [callback, context])) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
var once = _.once(function() {
|
||||||
|
self.stopReplying(name);
|
||||||
|
return makeCallback(callback).apply(this, arguments);
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.reply(name, once, context);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove handler(s)
|
||||||
|
stopReplying: function(name, callback, context) {
|
||||||
|
if (Radio._eventsApi(this, 'stopReplying', name)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove everything if there are no arguments passed
|
||||||
|
if (!name && !callback && !context) {
|
||||||
|
delete this._requests;
|
||||||
|
} else if (!removeHandlers(this._requests, name, callback, context)) {
|
||||||
|
Radio.debugLog('Attempted to remove the unregistered request', name, this.channelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.channel
|
||||||
|
* ----------------------
|
||||||
|
* Get a reference to a channel by name.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Radio._channels = {};
|
||||||
|
|
||||||
|
Radio.channel = function(channelName) {
|
||||||
|
if (!channelName) {
|
||||||
|
throw new Error('You must provide a name for the channel.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Radio._channels[channelName]) {
|
||||||
|
return Radio._channels[channelName];
|
||||||
|
} else {
|
||||||
|
return (Radio._channels[channelName] = new Radio.Channel(channelName));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backbone.Radio.Channel
|
||||||
|
* ----------------------
|
||||||
|
* A Channel is an object that extends from Backbone.Events,
|
||||||
|
* and Radio.Requests.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Radio.Channel = function(channelName) {
|
||||||
|
this.channelName = channelName;
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Radio.Channel.prototype, Backbone.Events, Radio.Requests, {
|
||||||
|
|
||||||
|
// Remove all handlers from the messaging systems of this channel
|
||||||
|
reset: function() {
|
||||||
|
this.off();
|
||||||
|
this.stopListening();
|
||||||
|
this.stopReplying();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Top-level API
|
||||||
|
* -------------
|
||||||
|
* Supplies the 'top-level API' for working with Channels directly
|
||||||
|
* from Backbone.Radio.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var channel, args, systems = [Backbone.Events, Radio.Requests];
|
||||||
|
|
||||||
|
_.each(systems, function(system) {
|
||||||
|
_.each(system, function(method, methodName) {
|
||||||
|
Radio[methodName] = function(channelName) {
|
||||||
|
args = _.toArray(arguments).slice(1);
|
||||||
|
channel = this.channel(channelName);
|
||||||
|
return channel[methodName].apply(channel, args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Radio.reset = function(channelName) {
|
||||||
|
var channels = !channelName ? this._channels : [this._channels[channelName]];
|
||||||
|
_.each(channels, function(channel) { channel.reset();});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Radio;
|
||||||
58
docs/bower_components/backbone.wreqr/.bower.json
vendored
Normal file
58
docs/bower_components/backbone.wreqr/.bower.json
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.wreqr",
|
||||||
|
"version": "1.4.0",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.wreqr",
|
||||||
|
"authors": [
|
||||||
|
"Derick Bailey"
|
||||||
|
],
|
||||||
|
"description": "A Simple Service Bus For Backbone and Backbone.Marionette",
|
||||||
|
"main": "lib/backbone.wreqr.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"plugin",
|
||||||
|
"computed",
|
||||||
|
"field",
|
||||||
|
"model"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": ">=0.9.9 <=1.3.x",
|
||||||
|
"underscore": ">=1.3.3 <=1.8.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "0.4.0",
|
||||||
|
"grunt-contrib-jasmine": "0.4.1",
|
||||||
|
"grunt-contrib-uglify": "0.1.2",
|
||||||
|
"grunt-contrib-concat": "0.1.3",
|
||||||
|
"grunt-contrib-jshint": "0.2.0",
|
||||||
|
"grunt-contrib-watch": "0.3.1",
|
||||||
|
"grunt-contrib-connect": "0.2.0",
|
||||||
|
"grunt-template-jasmine-istanbul": "0.2.0",
|
||||||
|
"grunt-preprocess": "2.0.0",
|
||||||
|
"grunt-plato": "0.1.5"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests",
|
||||||
|
"public",
|
||||||
|
"spec",
|
||||||
|
".gitignore",
|
||||||
|
".jshintrc",
|
||||||
|
".travis.yml",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"component.json",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"_release": "1.4.0",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v1.4.0",
|
||||||
|
"commit": "ce4665f7e13ec46d66fe9215f5a91199e29dff51"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/marionettejs/backbone.wreqr.git",
|
||||||
|
"_target": "^1.0.0",
|
||||||
|
"_originalSource": "backbone.wreqr"
|
||||||
|
}
|
||||||
84
docs/bower_components/backbone.wreqr/CHANGELOG.md
vendored
Normal file
84
docs/bower_components/backbone.wreqr/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# Change log
|
||||||
|
|
||||||
|
### v1.4.0
|
||||||
|
* Align code to be able to work with lodash 4.x in addition to underscore
|
||||||
|
|
||||||
|
### v1.3.7
|
||||||
|
* Bump version range of backbone.
|
||||||
|
|
||||||
|
### v1.3.6
|
||||||
|
* Bump version range of backbone.
|
||||||
|
|
||||||
|
### v1.3.5
|
||||||
|
* Bump version range of backbone.
|
||||||
|
|
||||||
|
### v1.3.4
|
||||||
|
* Bump version range of backbone.
|
||||||
|
|
||||||
|
### v1.3.3
|
||||||
|
* Bump version range of backbone and underscore support.
|
||||||
|
|
||||||
|
### v1.3.2
|
||||||
|
* Increase underscore range
|
||||||
|
* Minor underscore refactors
|
||||||
|
|
||||||
|
### v1.3.1
|
||||||
|
* Fix UMD setup and build process
|
||||||
|
|
||||||
|
### v1.3.0
|
||||||
|
* Add Wreqr.noConflict()
|
||||||
|
* Add Wreqr.VERSION
|
||||||
|
* Fixed a bug where reqres would not return a value using the 'top-level' Channel API.
|
||||||
|
|
||||||
|
### v1.2.1
|
||||||
|
* Remove AMD builds and add a single UMD style build.
|
||||||
|
|
||||||
|
### v1.2.0
|
||||||
|
* Adds Radio, allowing you to create explicit namespaces called Channels. A Channel is made up of
|
||||||
|
an instance of each of the three messaging systems.
|
||||||
|
|
||||||
|
### v1.1.0
|
||||||
|
* Removes the Error on unhandled commands/requests
|
||||||
|
|
||||||
|
### v1.0.1
|
||||||
|
* update dependencies
|
||||||
|
|
||||||
|
### v1.0.0
|
||||||
|
* major version release
|
||||||
|
* minor fixes
|
||||||
|
|
||||||
|
### v0.2.0
|
||||||
|
|
||||||
|
* Handlers (Commands/RequestResponse)
|
||||||
|
* **BREAKING:** renamed `addHandler` to `setHandler` to clarify the point of single handlers per named item
|
||||||
|
* Allow an `initialize` function when extending from the base type
|
||||||
|
* Added a `setHandlers` function that takes an object literal as the parameter, to configure multiple handlers in a single call
|
||||||
|
|
||||||
|
* Commands
|
||||||
|
* Introduced Wreqr.CommandStorage to store commands for later execution
|
||||||
|
* When a command has no handler, it will be stored for later execution
|
||||||
|
* When a handler for a stored command is added, the stored command will be
|
||||||
|
executed
|
||||||
|
|
||||||
|
* Updated build process to use Grunt v0.4
|
||||||
|
|
||||||
|
### v0.1.1
|
||||||
|
|
||||||
|
* Fixed "option strict" to be "use strict" ... #facepalm :P
|
||||||
|
* Added jam package config
|
||||||
|
|
||||||
|
### v0.1.0
|
||||||
|
|
||||||
|
* Fix calls to `.apply` to account for IE < 9 throwing an error when `arguments` is null or undefined
|
||||||
|
|
||||||
|
### v0.0.1
|
||||||
|
|
||||||
|
* Commands
|
||||||
|
* Can specify multiple arguments for `execute` method
|
||||||
|
|
||||||
|
* RequestResponse
|
||||||
|
* Can specify multiple arguments for `request` method
|
||||||
|
|
||||||
|
### v0.0.0
|
||||||
|
|
||||||
|
* Initial release
|
||||||
5
docs/bower_components/backbone.wreqr/LICENSE.md
vendored
Normal file
5
docs/bower_components/backbone.wreqr/LICENSE.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Backbone.Wreqr
|
||||||
|
|
||||||
|
Copyright (C)2012 Derick Bailey, Muted Solutions, LLC
|
||||||
|
|
||||||
|
Distributed Under MIT License
|
||||||
49
docs/bower_components/backbone.wreqr/bower.json
vendored
Normal file
49
docs/bower_components/backbone.wreqr/bower.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone.wreqr",
|
||||||
|
"version": "1.4.0",
|
||||||
|
"homepage": "https://github.com/marionettejs/backbone.wreqr",
|
||||||
|
"authors": [
|
||||||
|
"Derick Bailey"
|
||||||
|
],
|
||||||
|
"description": "A Simple Service Bus For Backbone and Backbone.Marionette",
|
||||||
|
"main": "lib/backbone.wreqr.js",
|
||||||
|
"keywords": [
|
||||||
|
"backbone",
|
||||||
|
"plugin",
|
||||||
|
"computed",
|
||||||
|
"field",
|
||||||
|
"model"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"backbone": ">=0.9.9 <=1.3.x",
|
||||||
|
"underscore": ">=1.3.3 <=1.8.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "0.4.0",
|
||||||
|
"grunt-contrib-jasmine": "0.4.1",
|
||||||
|
"grunt-contrib-uglify": "0.1.2",
|
||||||
|
"grunt-contrib-concat": "0.1.3",
|
||||||
|
"grunt-contrib-jshint": "0.2.0",
|
||||||
|
"grunt-contrib-watch": "0.3.1",
|
||||||
|
"grunt-contrib-connect": "0.2.0",
|
||||||
|
"grunt-template-jasmine-istanbul": "0.2.0",
|
||||||
|
"grunt-preprocess": "2.0.0",
|
||||||
|
"grunt-plato": "0.1.5"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests",
|
||||||
|
"public",
|
||||||
|
"spec",
|
||||||
|
".gitignore",
|
||||||
|
".jshintrc",
|
||||||
|
".travis.yml",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"component.json",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
435
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.js
vendored
Normal file
435
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.js
vendored
Normal file
@@ -0,0 +1,435 @@
|
|||||||
|
// Backbone.Wreqr (Backbone.Marionette)
|
||||||
|
// ----------------------------------
|
||||||
|
// v1.4.0
|
||||||
|
//
|
||||||
|
// Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
|
||||||
|
// Distributed under MIT license
|
||||||
|
//
|
||||||
|
// http://github.com/marionettejs/backbone.wreqr
|
||||||
|
|
||||||
|
|
||||||
|
(function(root, factory) {
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['backbone', 'underscore'], function(Backbone, _) {
|
||||||
|
return factory(Backbone, _);
|
||||||
|
});
|
||||||
|
} else if (typeof exports !== 'undefined') {
|
||||||
|
var Backbone = require('backbone');
|
||||||
|
var _ = require('underscore');
|
||||||
|
module.exports = factory(Backbone, _);
|
||||||
|
} else {
|
||||||
|
factory(root.Backbone, root._);
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this, function(Backbone, _) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var previousWreqr = Backbone.Wreqr;
|
||||||
|
|
||||||
|
var Wreqr = Backbone.Wreqr = {};
|
||||||
|
|
||||||
|
Backbone.Wreqr.VERSION = '1.4.0';
|
||||||
|
|
||||||
|
Backbone.Wreqr.noConflict = function () {
|
||||||
|
Backbone.Wreqr = previousWreqr;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handlers
|
||||||
|
// --------
|
||||||
|
// A registry of functions to call, given a name
|
||||||
|
|
||||||
|
Wreqr.Handlers = (function(Backbone, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
// -----------
|
||||||
|
|
||||||
|
var Handlers = function(options){
|
||||||
|
this.options = options;
|
||||||
|
this._wreqrHandlers = {};
|
||||||
|
|
||||||
|
if (_.isFunction(this.initialize)){
|
||||||
|
this.initialize(options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Handlers.extend = Backbone.Model.extend;
|
||||||
|
|
||||||
|
// Instance Members
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
_.extend(Handlers.prototype, Backbone.Events, {
|
||||||
|
|
||||||
|
// Add multiple handlers using an object literal configuration
|
||||||
|
setHandlers: function(handlers){
|
||||||
|
_.each(handlers, _.bind(function(handler, name){
|
||||||
|
var context = null;
|
||||||
|
|
||||||
|
if (_.isObject(handler) && !_.isFunction(handler)){
|
||||||
|
context = handler.context;
|
||||||
|
handler = handler.callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setHandler(name, handler, context);
|
||||||
|
}, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add a handler for the given name, with an
|
||||||
|
// optional context to run the handler within
|
||||||
|
setHandler: function(name, handler, context){
|
||||||
|
var config = {
|
||||||
|
callback: handler,
|
||||||
|
context: context
|
||||||
|
};
|
||||||
|
|
||||||
|
this._wreqrHandlers[name] = config;
|
||||||
|
|
||||||
|
this.trigger("handler:add", name, handler, context);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Determine whether or not a handler is registered
|
||||||
|
hasHandler: function(name){
|
||||||
|
return !! this._wreqrHandlers[name];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Get the currently registered handler for
|
||||||
|
// the specified name. Throws an exception if
|
||||||
|
// no handler is found.
|
||||||
|
getHandler: function(name){
|
||||||
|
var config = this._wreqrHandlers[name];
|
||||||
|
|
||||||
|
if (!config){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(){
|
||||||
|
return config.callback.apply(config.context, arguments);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove a handler for the specified name
|
||||||
|
removeHandler: function(name){
|
||||||
|
delete this._wreqrHandlers[name];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove all handlers from this registry
|
||||||
|
removeAllHandlers: function(){
|
||||||
|
this._wreqrHandlers = {};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Handlers;
|
||||||
|
})(Backbone, _);
|
||||||
|
|
||||||
|
// Wreqr.CommandStorage
|
||||||
|
// --------------------
|
||||||
|
//
|
||||||
|
// Store and retrieve commands for execution.
|
||||||
|
Wreqr.CommandStorage = (function(){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Constructor function
|
||||||
|
var CommandStorage = function(options){
|
||||||
|
this.options = options;
|
||||||
|
this._commands = {};
|
||||||
|
|
||||||
|
if (_.isFunction(this.initialize)){
|
||||||
|
this.initialize(options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Instance methods
|
||||||
|
_.extend(CommandStorage.prototype, Backbone.Events, {
|
||||||
|
|
||||||
|
// Get an object literal by command name, that contains
|
||||||
|
// the `commandName` and the `instances` of all commands
|
||||||
|
// represented as an array of arguments to process
|
||||||
|
getCommands: function(commandName){
|
||||||
|
var commands = this._commands[commandName];
|
||||||
|
|
||||||
|
// we don't have it, so add it
|
||||||
|
if (!commands){
|
||||||
|
|
||||||
|
// build the configuration
|
||||||
|
commands = {
|
||||||
|
command: commandName,
|
||||||
|
instances: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// store it
|
||||||
|
this._commands[commandName] = commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
return commands;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add a command by name, to the storage and store the
|
||||||
|
// args for the command
|
||||||
|
addCommand: function(commandName, args){
|
||||||
|
var command = this.getCommands(commandName);
|
||||||
|
command.instances.push(args);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Clear all commands for the given `commandName`
|
||||||
|
clearCommands: function(commandName){
|
||||||
|
var command = this.getCommands(commandName);
|
||||||
|
command.instances = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return CommandStorage;
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Wreqr.Commands
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// A simple command pattern implementation. Register a command
|
||||||
|
// handler and execute it.
|
||||||
|
Wreqr.Commands = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return Wreqr.Handlers.extend({
|
||||||
|
// default storage type
|
||||||
|
storageType: Wreqr.CommandStorage,
|
||||||
|
|
||||||
|
constructor: function(options){
|
||||||
|
this.options = options || {};
|
||||||
|
|
||||||
|
this._initializeStorage(this.options);
|
||||||
|
this.on("handler:add", this._executeCommands, this);
|
||||||
|
|
||||||
|
Wreqr.Handlers.prototype.constructor.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Execute a named command with the supplied args
|
||||||
|
execute: function(name){
|
||||||
|
name = arguments[0];
|
||||||
|
var args = _.rest(arguments);
|
||||||
|
|
||||||
|
if (this.hasHandler(name)){
|
||||||
|
this.getHandler(name).apply(this, args);
|
||||||
|
} else {
|
||||||
|
this.storage.addCommand(name, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// Internal method to handle bulk execution of stored commands
|
||||||
|
_executeCommands: function(name, handler, context){
|
||||||
|
var command = this.storage.getCommands(name);
|
||||||
|
|
||||||
|
// loop through and execute all the stored command instances
|
||||||
|
_.each(command.instances, function(args){
|
||||||
|
handler.apply(context, args);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.storage.clearCommands(name);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Internal method to initialize storage either from the type's
|
||||||
|
// `storageType` or the instance `options.storageType`.
|
||||||
|
_initializeStorage: function(options){
|
||||||
|
var storage;
|
||||||
|
|
||||||
|
var StorageType = options.storageType || this.storageType;
|
||||||
|
if (_.isFunction(StorageType)){
|
||||||
|
storage = new StorageType();
|
||||||
|
} else {
|
||||||
|
storage = StorageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.storage = storage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
|
|
||||||
|
// Wreqr.RequestResponse
|
||||||
|
// ---------------------
|
||||||
|
//
|
||||||
|
// A simple request/response implementation. Register a
|
||||||
|
// request handler, and return a response from it
|
||||||
|
Wreqr.RequestResponse = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return Wreqr.Handlers.extend({
|
||||||
|
request: function(name){
|
||||||
|
if (this.hasHandler(name)) {
|
||||||
|
return this.getHandler(name).apply(this, _.rest(arguments));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
|
|
||||||
|
// Event Aggregator
|
||||||
|
// ----------------
|
||||||
|
// A pub-sub object that can be used to decouple various parts
|
||||||
|
// of an application through event-driven architecture.
|
||||||
|
|
||||||
|
Wreqr.EventAggregator = (function(Backbone, _){
|
||||||
|
"use strict";
|
||||||
|
var EA = function(){};
|
||||||
|
|
||||||
|
// Copy the `extend` function used by Backbone's classes
|
||||||
|
EA.extend = Backbone.Model.extend;
|
||||||
|
|
||||||
|
// Copy the basic Backbone.Events on to the event aggregator
|
||||||
|
_.extend(EA.prototype, Backbone.Events);
|
||||||
|
|
||||||
|
return EA;
|
||||||
|
})(Backbone, _);
|
||||||
|
|
||||||
|
// Wreqr.Channel
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// An object that wraps the three messaging systems:
|
||||||
|
// EventAggregator, RequestResponse, Commands
|
||||||
|
Wreqr.Channel = (function(Wreqr){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Channel = function(channelName) {
|
||||||
|
this.vent = new Backbone.Wreqr.EventAggregator();
|
||||||
|
this.reqres = new Backbone.Wreqr.RequestResponse();
|
||||||
|
this.commands = new Backbone.Wreqr.Commands();
|
||||||
|
this.channelName = channelName;
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Channel.prototype, {
|
||||||
|
|
||||||
|
// Remove all handlers from the messaging systems of this channel
|
||||||
|
reset: function() {
|
||||||
|
this.vent.off();
|
||||||
|
this.vent.stopListening();
|
||||||
|
this.reqres.removeAllHandlers();
|
||||||
|
this.commands.removeAllHandlers();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Connect a hash of events; one for each messaging system
|
||||||
|
connectEvents: function(hash, context) {
|
||||||
|
this._connect('vent', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
connectCommands: function(hash, context) {
|
||||||
|
this._connect('commands', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
connectRequests: function(hash, context) {
|
||||||
|
this._connect('reqres', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Attach the handlers to a given message system `type`
|
||||||
|
_connect: function(type, hash, context) {
|
||||||
|
if (!hash) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context = context || this;
|
||||||
|
var method = (type === 'vent') ? 'on' : 'setHandler';
|
||||||
|
|
||||||
|
_.each(hash, _.bind(function(fn, eventName) {
|
||||||
|
this[type][method](eventName, _.bind(fn, context));
|
||||||
|
}, this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return Channel;
|
||||||
|
})(Wreqr);
|
||||||
|
|
||||||
|
// Wreqr.Radio
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// An object that lets you communicate with many channels.
|
||||||
|
Wreqr.radio = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Radio = function() {
|
||||||
|
this._channels = {};
|
||||||
|
this.vent = {};
|
||||||
|
this.commands = {};
|
||||||
|
this.reqres = {};
|
||||||
|
this._proxyMethods();
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Radio.prototype, {
|
||||||
|
|
||||||
|
channel: function(channelName) {
|
||||||
|
if (!channelName) {
|
||||||
|
throw new Error('Channel must receive a name');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._getChannel( channelName );
|
||||||
|
},
|
||||||
|
|
||||||
|
_getChannel: function(channelName) {
|
||||||
|
var channel = this._channels[channelName];
|
||||||
|
|
||||||
|
if(!channel) {
|
||||||
|
channel = new Wreqr.Channel(channelName);
|
||||||
|
this._channels[channelName] = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return channel;
|
||||||
|
},
|
||||||
|
|
||||||
|
_proxyMethods: function() {
|
||||||
|
_.each(['vent', 'commands', 'reqres'], _.bind(function(system) {
|
||||||
|
_.each( messageSystems[system], _.bind(function(method) {
|
||||||
|
this[system][method] = proxyMethod(this, system, method);
|
||||||
|
}, this));
|
||||||
|
}, this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var messageSystems = {
|
||||||
|
vent: [
|
||||||
|
'on',
|
||||||
|
'off',
|
||||||
|
'trigger',
|
||||||
|
'once',
|
||||||
|
'stopListening',
|
||||||
|
'listenTo',
|
||||||
|
'listenToOnce'
|
||||||
|
],
|
||||||
|
|
||||||
|
commands: [
|
||||||
|
'execute',
|
||||||
|
'setHandler',
|
||||||
|
'setHandlers',
|
||||||
|
'removeHandler',
|
||||||
|
'removeAllHandlers'
|
||||||
|
],
|
||||||
|
|
||||||
|
reqres: [
|
||||||
|
'request',
|
||||||
|
'setHandler',
|
||||||
|
'setHandlers',
|
||||||
|
'removeHandler',
|
||||||
|
'removeAllHandlers'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
var proxyMethod = function(radio, system, method) {
|
||||||
|
return function(channelName) {
|
||||||
|
var messageSystem = radio._getChannel(channelName)[system];
|
||||||
|
|
||||||
|
return messageSystem[method].apply(messageSystem, _.rest(arguments));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Radio();
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
|
|
||||||
|
|
||||||
|
return Backbone.Wreqr;
|
||||||
|
|
||||||
|
}));
|
||||||
1
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.map
vendored
Normal file
1
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.map
vendored
Normal file
File diff suppressed because one or more lines are too long
13
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.min.js
vendored
Normal file
13
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.min.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// Backbone.Wreqr (Backbone.Marionette)
|
||||||
|
// ----------------------------------
|
||||||
|
// v1.4.0
|
||||||
|
//
|
||||||
|
// Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
|
||||||
|
// Distributed under MIT license
|
||||||
|
//
|
||||||
|
// http://github.com/marionettejs/backbone.wreqr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";var c=a.Wreqr,d=a.Wreqr={};return a.Wreqr.VERSION="1.4.0",a.Wreqr.noConflict=function(){return a.Wreqr=c,this},d.Handlers=function(a,b){var c=function(a){this.options=a,this._wreqrHandlers={},b.isFunction(this.initialize)&&this.initialize(a)};return c.extend=a.Model.extend,b.extend(c.prototype,a.Events,{setHandlers:function(a){b.each(a,b.bind(function(a,c){var d=null;b.isObject(a)&&!b.isFunction(a)&&(d=a.context,a=a.callback),this.setHandler(c,a,d)},this))},setHandler:function(a,b,c){var d={callback:b,context:c};this._wreqrHandlers[a]=d,this.trigger("handler:add",a,b,c)},hasHandler:function(a){return!!this._wreqrHandlers[a]},getHandler:function(a){var b=this._wreqrHandlers[a];if(b)return function(){return b.callback.apply(b.context,arguments)}},removeHandler:function(a){delete this._wreqrHandlers[a]},removeAllHandlers:function(){this._wreqrHandlers={}}}),c}(a,b),d.CommandStorage=function(){var c=function(a){this.options=a,this._commands={},b.isFunction(this.initialize)&&this.initialize(a)};return b.extend(c.prototype,a.Events,{getCommands:function(a){var b=this._commands[a];return b||(b={command:a,instances:[]},this._commands[a]=b),b},addCommand:function(a,b){var c=this.getCommands(a);c.instances.push(b)},clearCommands:function(a){var b=this.getCommands(a);b.instances=[]}}),c}(),d.Commands=function(a,b){return a.Handlers.extend({storageType:a.CommandStorage,constructor:function(b){this.options=b||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this),a.Handlers.prototype.constructor.apply(this,arguments)},execute:function(a){a=arguments[0];var c=b.rest(arguments);this.hasHandler(a)?this.getHandler(a).apply(this,c):this.storage.addCommand(a,c)},_executeCommands:function(a,c,d){var e=this.storage.getCommands(a);b.each(e.instances,function(a){c.apply(d,a)}),this.storage.clearCommands(a)},_initializeStorage:function(a){var c,d=a.storageType||this.storageType;c=b.isFunction(d)?new d:d,this.storage=c}})}(d,b),d.RequestResponse=function(a,b){return a.Handlers.extend({request:function(a){return this.hasHandler(a)?this.getHandler(a).apply(this,b.rest(arguments)):void 0}})}(d,b),d.EventAggregator=function(a,b){var c=function(){};return c.extend=a.Model.extend,b.extend(c.prototype,a.Events),c}(a,b),d.Channel=function(c){var d=function(b){this.vent=new a.Wreqr.EventAggregator,this.reqres=new a.Wreqr.RequestResponse,this.commands=new a.Wreqr.Commands,this.channelName=b};return b.extend(d.prototype,{reset:function(){return this.vent.off(),this.vent.stopListening(),this.reqres.removeAllHandlers(),this.commands.removeAllHandlers(),this},connectEvents:function(a,b){return this._connect("vent",a,b),this},connectCommands:function(a,b){return this._connect("commands",a,b),this},connectRequests:function(a,b){return this._connect("reqres",a,b),this},_connect:function(a,c,d){if(c){d=d||this;var e="vent"===a?"on":"setHandler";b.each(c,b.bind(function(c,f){this[a][e](f,b.bind(c,d))},this))}}}),d}(d),d.radio=function(a,b){var c=function(){this._channels={},this.vent={},this.commands={},this.reqres={},this._proxyMethods()};b.extend(c.prototype,{channel:function(a){if(!a)throw new Error("Channel must receive a name");return this._getChannel(a)},_getChannel:function(b){var c=this._channels[b];return c||(c=new a.Channel(b),this._channels[b]=c),c},_proxyMethods:function(){b.each(["vent","commands","reqres"],b.bind(function(a){b.each(d[a],b.bind(function(b){this[a][b]=e(this,a,b)},this))},this))}});var d={vent:["on","off","trigger","once","stopListening","listenTo","listenToOnce"],commands:["execute","setHandler","setHandlers","removeHandler","removeAllHandlers"],reqres:["request","setHandler","setHandlers","removeHandler","removeAllHandlers"]},e=function(a,c,d){return function(e){var f=a._getChannel(e)[c];return f[d].apply(f,b.rest(arguments))}};return new c}(d,b),a.Wreqr});
|
||||||
|
//# sourceMappingURL=backbone.wreqr.min.js.map
|
||||||
1
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.min.js.map
vendored
Normal file
1
docs/bower_components/backbone.wreqr/lib/backbone.wreqr.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
186
docs/bower_components/backbone.wreqr/readme.md
vendored
Normal file
186
docs/bower_components/backbone.wreqr/readme.md
vendored
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
<h1 align="center">Backbone.Wreqr</h1>
|
||||||
|
<p align="center">
|
||||||
|
<a title='Build Status' href="https://travis-ci.org/marionettejs/backbone.wreqr">
|
||||||
|
<img src='https://travis-ci.org/marionettejs/backbone.wreqr.svg' />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
A simple infrastructure based on [messaging patterns](http://www.eaipatterns.com/)
|
||||||
|
and service bus implementations for decoupling [Backbone](http://backbonejs.org)
|
||||||
|
and [Backbone.Marionette](http://marionettejs.com) applications.
|
||||||
|
|
||||||
|
**Notice:** In the next major release of Marionette, v3, Wreqr will be swapped for an updated library,
|
||||||
|
[Radio](https://github.com/jmeas/backbone.radio). If you've already begun using Wreqr, don't worry. This change
|
||||||
|
isn't for quite some time: a few months, at the earliest. Also, we will support easily swapping the two libraries,
|
||||||
|
so you won't run into any problems if you decide to continue using Wreqr.
|
||||||
|
|
||||||
|
For an introduction to Radio, check out
|
||||||
|
[our blog post](http://blog.marionettejs.com/2014/07/11/introducing-backbone-radio/index.html). As of Marionette v2.1, you can easily
|
||||||
|
swap in Radio for Wreqr with [this shim](https://gist.github.com/jmeas/7992474cdb1c5672d88b). We think you'll really like the changes!
|
||||||
|
|
||||||
|
## Downloads And Source
|
||||||
|
|
||||||
|
Grab the source from the `src` folder above. Grab the most recent builds
|
||||||
|
from the links below.
|
||||||
|
|
||||||
|
### Standard Builds
|
||||||
|
|
||||||
|
* Development: [backbone.wreqr.js](https://raw.github.com/marionettejs/backbone.wreqr/master/lib/backbone.wreqr.js)
|
||||||
|
|
||||||
|
* Production: [backbone.wreqr.min.js](https://raw.github.com/marionettejs/backbone.wreqr/master/lib/backbone.wreqr.min.js)
|
||||||
|
|
||||||
|
## Basic Use
|
||||||
|
|
||||||
|
### Event Aggregator
|
||||||
|
|
||||||
|
An event aggregator implementation. It extends from `Backbone.Events` to
|
||||||
|
provide the core event handling code in an object that can itself be
|
||||||
|
extended and instantiated as needed.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var vent = new Backbone.Wreqr.EventAggregator();
|
||||||
|
|
||||||
|
vent.on("foo", function(){
|
||||||
|
console.log("foo event");
|
||||||
|
});
|
||||||
|
|
||||||
|
vent.trigger("foo");
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commands And Request / Response
|
||||||
|
|
||||||
|
Wreqr can be used by instantiating a `Backbone.Wreqr.Commands`
|
||||||
|
or `Backbone.Wreqr.RequestResponse` object. These objects provide a
|
||||||
|
`setHandler` method to add a handler for a named request or command.
|
||||||
|
Commands can then be executed with the `execute` method, and
|
||||||
|
request/response can be done through the `request` method.
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
```js
|
||||||
|
var commands = new Backbone.Wreqr.Commands();
|
||||||
|
|
||||||
|
commands.setHandler("foo", function(){
|
||||||
|
console.log("the foo command was executed");
|
||||||
|
});
|
||||||
|
|
||||||
|
commands.execute("foo");
|
||||||
|
```
|
||||||
|
|
||||||
|
### Request/Response
|
||||||
|
|
||||||
|
```js
|
||||||
|
var reqres = new Backbone.Wreqr.RequestResponse();
|
||||||
|
|
||||||
|
reqres.setHandler("foo", function(){
|
||||||
|
return "foo requested. this is the response";
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = reqres.request("foo");
|
||||||
|
console.log(result);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Radio
|
||||||
|
|
||||||
|
Radio is a convenient way for emitting events through channels. Radio can be used to either retrieve a channel, or talk through a channel with either command, reqres, or vent.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// channels
|
||||||
|
var globalChannel = Backbone.Wreqr.radio.channel('global');
|
||||||
|
var userChannel = Backbone.Wreqr.radio.channel('user');
|
||||||
|
|
||||||
|
// Wreqr events
|
||||||
|
Backbone.Wreqr.radio.commands.execute( 'global', 'shutdown' );
|
||||||
|
Backbone.Wreqr.radio.reqres.request( 'global', 'current-user' );
|
||||||
|
Backbone.Wreqr.radio.vent.trigger( 'global', 'game-over');
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Channel
|
||||||
|
Channel is an object that wraps EventAggregator, Commands, and Reqres. Channels provide a convenient way for the objects in your system to talk to one another without the global channel becoming too noisy.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// global channel
|
||||||
|
var globalChannel = Backbone.Wreqr.radio.channel('global');
|
||||||
|
globalChannel.commands.execute('shutdown' );
|
||||||
|
globalChannel.reqres.request('current-user' );
|
||||||
|
globalChannel.vent.trigger('game-over');
|
||||||
|
|
||||||
|
// user channel
|
||||||
|
var userChannel = Backbone.Wreqr.radio.channel('user');
|
||||||
|
userChannel.commands.execute('punnish');
|
||||||
|
userChannel.reqres.request('user-avatar');
|
||||||
|
userChannel.vent.trigger('win', {
|
||||||
|
level: 2,
|
||||||
|
stars: 3
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Multiple Handlers
|
||||||
|
|
||||||
|
Multiple handlers can be set on the Commands and RequestResponse
|
||||||
|
objects in a single call, using the `setHandlers` method and supplying
|
||||||
|
a `{"name": configuration}` hash where the `configuration` is an
|
||||||
|
object literal or a function.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var reqres = new Backbone.Wreqr.RequestResponse();
|
||||||
|
|
||||||
|
reqres.setHandlers({
|
||||||
|
"foo": function(){ /* ... */ },
|
||||||
|
"bar": {
|
||||||
|
callback: function(){ /* ... */ },
|
||||||
|
context: someObject
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = reqres.request("foo");
|
||||||
|
```
|
||||||
|
|
||||||
|
The "foo" handler is assigned directly to a function, while the
|
||||||
|
"bar" handler is assigned to a function with a specific context
|
||||||
|
to execute the function within.
|
||||||
|
|
||||||
|
This works for all `Handlers`, `Commands` and `RequestResponse`
|
||||||
|
objects.
|
||||||
|
|
||||||
|
### Removing Handlers
|
||||||
|
|
||||||
|
Removing handlers for commands or requests is done the
|
||||||
|
same way, with the `removeHandler` or `removeAllHandlers`
|
||||||
|
functions.
|
||||||
|
|
||||||
|
```js
|
||||||
|
reqres.removeHandler("foo");
|
||||||
|
|
||||||
|
commands.removeAllHandlers();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Extending Wreqr Objects
|
||||||
|
|
||||||
|
The EventAggregator, Commands and RequestResponse objects can all be
|
||||||
|
extended using Backbone's standard `extend` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var MyEventAgg = Backbone.Wreqr.EventAggregator.extend({
|
||||||
|
foo: function(){...}
|
||||||
|
});
|
||||||
|
|
||||||
|
var MyCommands = Backbone.Wreqr.Commands.extend({
|
||||||
|
foo: function(){...}
|
||||||
|
});
|
||||||
|
|
||||||
|
var MyReqRes = Backbone.Wreqr.RequestResponse.extend({
|
||||||
|
foo: function(){...}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT - see [LICENSE.md](https://raw.github.com/marionettejs/backbone.wreqr/master/LICENSE.md)
|
||||||
|
|
||||||
|
## Dev
|
||||||
|
* `npm install`
|
||||||
|
* `npm install -g grunt-cli`
|
||||||
|
* `grunt`
|
||||||
|
|
||||||
39
docs/bower_components/backbone.wreqr/src/build/backbone.wreqr.js
vendored
Normal file
39
docs/bower_components/backbone.wreqr/src/build/backbone.wreqr.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
(function(root, factory) {
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['backbone', 'underscore'], function(Backbone, _) {
|
||||||
|
return factory(Backbone, _);
|
||||||
|
});
|
||||||
|
} else if (typeof exports !== 'undefined') {
|
||||||
|
var Backbone = require('backbone');
|
||||||
|
var _ = require('underscore');
|
||||||
|
module.exports = factory(Backbone, _);
|
||||||
|
} else {
|
||||||
|
factory(root.Backbone, root._);
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this, function(Backbone, _) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var previousWreqr = Backbone.Wreqr;
|
||||||
|
|
||||||
|
var Wreqr = Backbone.Wreqr = {};
|
||||||
|
|
||||||
|
Backbone.Wreqr.VERSION = '<%= version %>';
|
||||||
|
|
||||||
|
Backbone.Wreqr.noConflict = function () {
|
||||||
|
Backbone.Wreqr = previousWreqr;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// @include ../wreqr.handlers.js
|
||||||
|
// @include ../wreqr.commandStorage.js
|
||||||
|
// @include ../wreqr.commands.js
|
||||||
|
// @include ../wreqr.requestresponse.js
|
||||||
|
// @include ../wreqr.eventaggregator.js
|
||||||
|
// @include ../wreqr.channel.js
|
||||||
|
// @include ../wreqr.radio.js
|
||||||
|
|
||||||
|
return Backbone.Wreqr;
|
||||||
|
|
||||||
|
}));
|
||||||
60
docs/bower_components/backbone.wreqr/src/wreqr.channel.js
vendored
Normal file
60
docs/bower_components/backbone.wreqr/src/wreqr.channel.js
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// Wreqr.Channel
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// An object that wraps the three messaging systems:
|
||||||
|
// EventAggregator, RequestResponse, Commands
|
||||||
|
Wreqr.Channel = (function(Wreqr){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Channel = function(channelName) {
|
||||||
|
this.vent = new Backbone.Wreqr.EventAggregator();
|
||||||
|
this.reqres = new Backbone.Wreqr.RequestResponse();
|
||||||
|
this.commands = new Backbone.Wreqr.Commands();
|
||||||
|
this.channelName = channelName;
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Channel.prototype, {
|
||||||
|
|
||||||
|
// Remove all handlers from the messaging systems of this channel
|
||||||
|
reset: function() {
|
||||||
|
this.vent.off();
|
||||||
|
this.vent.stopListening();
|
||||||
|
this.reqres.removeAllHandlers();
|
||||||
|
this.commands.removeAllHandlers();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Connect a hash of events; one for each messaging system
|
||||||
|
connectEvents: function(hash, context) {
|
||||||
|
this._connect('vent', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
connectCommands: function(hash, context) {
|
||||||
|
this._connect('commands', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
connectRequests: function(hash, context) {
|
||||||
|
this._connect('reqres', hash, context);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Attach the handlers to a given message system `type`
|
||||||
|
_connect: function(type, hash, context) {
|
||||||
|
if (!hash) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context = context || this;
|
||||||
|
var method = (type === 'vent') ? 'on' : 'setHandler';
|
||||||
|
|
||||||
|
_.each(hash, _.bind(function(fn, eventName) {
|
||||||
|
this[type][method](eventName, _.bind(fn, context));
|
||||||
|
}, this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return Channel;
|
||||||
|
})(Wreqr);
|
||||||
58
docs/bower_components/backbone.wreqr/src/wreqr.commandStorage.js
vendored
Normal file
58
docs/bower_components/backbone.wreqr/src/wreqr.commandStorage.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// Wreqr.CommandStorage
|
||||||
|
// --------------------
|
||||||
|
//
|
||||||
|
// Store and retrieve commands for execution.
|
||||||
|
Wreqr.CommandStorage = (function(){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Constructor function
|
||||||
|
var CommandStorage = function(options){
|
||||||
|
this.options = options;
|
||||||
|
this._commands = {};
|
||||||
|
|
||||||
|
if (_.isFunction(this.initialize)){
|
||||||
|
this.initialize(options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Instance methods
|
||||||
|
_.extend(CommandStorage.prototype, Backbone.Events, {
|
||||||
|
|
||||||
|
// Get an object literal by command name, that contains
|
||||||
|
// the `commandName` and the `instances` of all commands
|
||||||
|
// represented as an array of arguments to process
|
||||||
|
getCommands: function(commandName){
|
||||||
|
var commands = this._commands[commandName];
|
||||||
|
|
||||||
|
// we don't have it, so add it
|
||||||
|
if (!commands){
|
||||||
|
|
||||||
|
// build the configuration
|
||||||
|
commands = {
|
||||||
|
command: commandName,
|
||||||
|
instances: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// store it
|
||||||
|
this._commands[commandName] = commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
return commands;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add a command by name, to the storage and store the
|
||||||
|
// args for the command
|
||||||
|
addCommand: function(commandName, args){
|
||||||
|
var command = this.getCommands(commandName);
|
||||||
|
command.instances.push(args);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Clear all commands for the given `commandName`
|
||||||
|
clearCommands: function(commandName){
|
||||||
|
var command = this.getCommands(commandName);
|
||||||
|
command.instances = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return CommandStorage;
|
||||||
|
})();
|
||||||
63
docs/bower_components/backbone.wreqr/src/wreqr.commands.js
vendored
Normal file
63
docs/bower_components/backbone.wreqr/src/wreqr.commands.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// Wreqr.Commands
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// A simple command pattern implementation. Register a command
|
||||||
|
// handler and execute it.
|
||||||
|
Wreqr.Commands = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return Wreqr.Handlers.extend({
|
||||||
|
// default storage type
|
||||||
|
storageType: Wreqr.CommandStorage,
|
||||||
|
|
||||||
|
constructor: function(options){
|
||||||
|
this.options = options || {};
|
||||||
|
|
||||||
|
this._initializeStorage(this.options);
|
||||||
|
this.on("handler:add", this._executeCommands, this);
|
||||||
|
|
||||||
|
Wreqr.Handlers.prototype.constructor.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Execute a named command with the supplied args
|
||||||
|
execute: function(name){
|
||||||
|
name = arguments[0];
|
||||||
|
var args = _.rest(arguments);
|
||||||
|
|
||||||
|
if (this.hasHandler(name)){
|
||||||
|
this.getHandler(name).apply(this, args);
|
||||||
|
} else {
|
||||||
|
this.storage.addCommand(name, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// Internal method to handle bulk execution of stored commands
|
||||||
|
_executeCommands: function(name, handler, context){
|
||||||
|
var command = this.storage.getCommands(name);
|
||||||
|
|
||||||
|
// loop through and execute all the stored command instances
|
||||||
|
_.each(command.instances, function(args){
|
||||||
|
handler.apply(context, args);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.storage.clearCommands(name);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Internal method to initialize storage either from the type's
|
||||||
|
// `storageType` or the instance `options.storageType`.
|
||||||
|
_initializeStorage: function(options){
|
||||||
|
var storage;
|
||||||
|
|
||||||
|
var StorageType = options.storageType || this.storageType;
|
||||||
|
if (_.isFunction(StorageType)){
|
||||||
|
storage = new StorageType();
|
||||||
|
} else {
|
||||||
|
storage = StorageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.storage = storage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
17
docs/bower_components/backbone.wreqr/src/wreqr.eventaggregator.js
vendored
Normal file
17
docs/bower_components/backbone.wreqr/src/wreqr.eventaggregator.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Event Aggregator
|
||||||
|
// ----------------
|
||||||
|
// A pub-sub object that can be used to decouple various parts
|
||||||
|
// of an application through event-driven architecture.
|
||||||
|
|
||||||
|
Wreqr.EventAggregator = (function(Backbone, _){
|
||||||
|
"use strict";
|
||||||
|
var EA = function(){};
|
||||||
|
|
||||||
|
// Copy the `extend` function used by Backbone's classes
|
||||||
|
EA.extend = Backbone.Model.extend;
|
||||||
|
|
||||||
|
// Copy the basic Backbone.Events on to the event aggregator
|
||||||
|
_.extend(EA.prototype, Backbone.Events);
|
||||||
|
|
||||||
|
return EA;
|
||||||
|
})(Backbone, _);
|
||||||
86
docs/bower_components/backbone.wreqr/src/wreqr.handlers.js
vendored
Normal file
86
docs/bower_components/backbone.wreqr/src/wreqr.handlers.js
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// Handlers
|
||||||
|
// --------
|
||||||
|
// A registry of functions to call, given a name
|
||||||
|
|
||||||
|
Wreqr.Handlers = (function(Backbone, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
// -----------
|
||||||
|
|
||||||
|
var Handlers = function(options){
|
||||||
|
this.options = options;
|
||||||
|
this._wreqrHandlers = {};
|
||||||
|
|
||||||
|
if (_.isFunction(this.initialize)){
|
||||||
|
this.initialize(options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Handlers.extend = Backbone.Model.extend;
|
||||||
|
|
||||||
|
// Instance Members
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
_.extend(Handlers.prototype, Backbone.Events, {
|
||||||
|
|
||||||
|
// Add multiple handlers using an object literal configuration
|
||||||
|
setHandlers: function(handlers){
|
||||||
|
_.each(handlers, _.bind(function(handler, name){
|
||||||
|
var context = null;
|
||||||
|
|
||||||
|
if (_.isObject(handler) && !_.isFunction(handler)){
|
||||||
|
context = handler.context;
|
||||||
|
handler = handler.callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setHandler(name, handler, context);
|
||||||
|
}, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add a handler for the given name, with an
|
||||||
|
// optional context to run the handler within
|
||||||
|
setHandler: function(name, handler, context){
|
||||||
|
var config = {
|
||||||
|
callback: handler,
|
||||||
|
context: context
|
||||||
|
};
|
||||||
|
|
||||||
|
this._wreqrHandlers[name] = config;
|
||||||
|
|
||||||
|
this.trigger("handler:add", name, handler, context);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Determine whether or not a handler is registered
|
||||||
|
hasHandler: function(name){
|
||||||
|
return !! this._wreqrHandlers[name];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Get the currently registered handler for
|
||||||
|
// the specified name. Throws an exception if
|
||||||
|
// no handler is found.
|
||||||
|
getHandler: function(name){
|
||||||
|
var config = this._wreqrHandlers[name];
|
||||||
|
|
||||||
|
if (!config){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(){
|
||||||
|
return config.callback.apply(config.context, arguments);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove a handler for the specified name
|
||||||
|
removeHandler: function(name){
|
||||||
|
delete this._wreqrHandlers[name];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove all handlers from this registry
|
||||||
|
removeAllHandlers: function(){
|
||||||
|
this._wreqrHandlers = {};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Handlers;
|
||||||
|
})(Backbone, _);
|
||||||
85
docs/bower_components/backbone.wreqr/src/wreqr.radio.js
vendored
Normal file
85
docs/bower_components/backbone.wreqr/src/wreqr.radio.js
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
// Wreqr.Radio
|
||||||
|
// --------------
|
||||||
|
//
|
||||||
|
// An object that lets you communicate with many channels.
|
||||||
|
Wreqr.radio = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Radio = function() {
|
||||||
|
this._channels = {};
|
||||||
|
this.vent = {};
|
||||||
|
this.commands = {};
|
||||||
|
this.reqres = {};
|
||||||
|
this._proxyMethods();
|
||||||
|
};
|
||||||
|
|
||||||
|
_.extend(Radio.prototype, {
|
||||||
|
|
||||||
|
channel: function(channelName) {
|
||||||
|
if (!channelName) {
|
||||||
|
throw new Error('Channel must receive a name');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._getChannel( channelName );
|
||||||
|
},
|
||||||
|
|
||||||
|
_getChannel: function(channelName) {
|
||||||
|
var channel = this._channels[channelName];
|
||||||
|
|
||||||
|
if(!channel) {
|
||||||
|
channel = new Wreqr.Channel(channelName);
|
||||||
|
this._channels[channelName] = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return channel;
|
||||||
|
},
|
||||||
|
|
||||||
|
_proxyMethods: function() {
|
||||||
|
_.each(['vent', 'commands', 'reqres'], _.bind(function(system) {
|
||||||
|
_.each( messageSystems[system], _.bind(function(method) {
|
||||||
|
this[system][method] = proxyMethod(this, system, method);
|
||||||
|
}, this));
|
||||||
|
}, this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var messageSystems = {
|
||||||
|
vent: [
|
||||||
|
'on',
|
||||||
|
'off',
|
||||||
|
'trigger',
|
||||||
|
'once',
|
||||||
|
'stopListening',
|
||||||
|
'listenTo',
|
||||||
|
'listenToOnce'
|
||||||
|
],
|
||||||
|
|
||||||
|
commands: [
|
||||||
|
'execute',
|
||||||
|
'setHandler',
|
||||||
|
'setHandlers',
|
||||||
|
'removeHandler',
|
||||||
|
'removeAllHandlers'
|
||||||
|
],
|
||||||
|
|
||||||
|
reqres: [
|
||||||
|
'request',
|
||||||
|
'setHandler',
|
||||||
|
'setHandlers',
|
||||||
|
'removeHandler',
|
||||||
|
'removeAllHandlers'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
var proxyMethod = function(radio, system, method) {
|
||||||
|
return function(channelName) {
|
||||||
|
var messageSystem = radio._getChannel(channelName)[system];
|
||||||
|
|
||||||
|
return messageSystem[method].apply(messageSystem, _.rest(arguments));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Radio();
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
17
docs/bower_components/backbone.wreqr/src/wreqr.requestresponse.js
vendored
Normal file
17
docs/bower_components/backbone.wreqr/src/wreqr.requestresponse.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Wreqr.RequestResponse
|
||||||
|
// ---------------------
|
||||||
|
//
|
||||||
|
// A simple request/response implementation. Register a
|
||||||
|
// request handler, and return a response from it
|
||||||
|
Wreqr.RequestResponse = (function(Wreqr, _){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return Wreqr.Handlers.extend({
|
||||||
|
request: function(name){
|
||||||
|
if (this.hasHandler(name)) {
|
||||||
|
return this.getHandler(name).apply(this, _.rest(arguments));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(Wreqr, _);
|
||||||
32
docs/bower_components/backbone/.bower.json
vendored
Normal file
32
docs/bower_components/backbone/.bower.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "backbone",
|
||||||
|
"main": "backbone.js",
|
||||||
|
"dependencies": {
|
||||||
|
"underscore": ">=1.7.0"
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"docs",
|
||||||
|
"examples",
|
||||||
|
"test",
|
||||||
|
"*.yml",
|
||||||
|
"*.html",
|
||||||
|
"*.ico",
|
||||||
|
"*.md",
|
||||||
|
"CNAME",
|
||||||
|
".*",
|
||||||
|
"karma.*",
|
||||||
|
"component.json",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jashkenas/backbone",
|
||||||
|
"version": "1.2.3",
|
||||||
|
"_release": "1.2.3",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "1.2.3",
|
||||||
|
"commit": "05fde9e201f7e2137796663081105cd6dad12a98"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/jashkenas/backbone.git",
|
||||||
|
"_target": ">=0.9.9 <=1.3.x",
|
||||||
|
"_originalSource": "backbone"
|
||||||
|
}
|
||||||
22
docs/bower_components/backbone/LICENSE
vendored
Normal file
22
docs/bower_components/backbone/LICENSE
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
2
docs/bower_components/backbone/backbone-min.js
vendored
Normal file
2
docs/bower_components/backbone/backbone-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/backbone/backbone-min.map
vendored
Normal file
1
docs/bower_components/backbone/backbone-min.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1894
docs/bower_components/backbone/backbone.js
vendored
Normal file
1894
docs/bower_components/backbone/backbone.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
docs/bower_components/backbone/bower.json
vendored
Normal file
8
docs/bower_components/backbone/bower.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name" : "backbone",
|
||||||
|
"main" : "backbone.js",
|
||||||
|
"dependencies" : {
|
||||||
|
"underscore" : ">=1.7.0"
|
||||||
|
},
|
||||||
|
"ignore" : ["docs", "examples", "test", "*.yml", "*.html", "*.ico", "*.md", "CNAME", ".*", "karma.*", "component.json", "package.json"]
|
||||||
|
}
|
||||||
17
docs/bower_components/handlebars/.bower.json
vendored
Normal file
17
docs/bower_components/handlebars/.bower.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "handlebars",
|
||||||
|
"version": "4.7.6",
|
||||||
|
"main": "handlebars.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {},
|
||||||
|
"homepage": "https://github.com/components/handlebars.js",
|
||||||
|
"_release": "4.7.6",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v4.7.6",
|
||||||
|
"commit": "c5c26b8040d726577f4aa1293b48fcaeab781821"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/components/handlebars.js.git",
|
||||||
|
"_target": "^4.0.5",
|
||||||
|
"_originalSource": "handlebars"
|
||||||
|
}
|
||||||
2
docs/bower_components/handlebars/.gitignore
vendored
Normal file
2
docs/bower_components/handlebars/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
vendor
|
||||||
|
composer.lock
|
||||||
12
docs/bower_components/handlebars/README.md
vendored
Normal file
12
docs/bower_components/handlebars/README.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Handlebars.js
|
||||||
|
=============
|
||||||
|
|
||||||
|
Shim repository for [Handlebars.js](http://handlebarsjs.com).
|
||||||
|
|
||||||
|
Package Managers
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* [Bower](http://twitter.github.com/bower/): `handlebars`
|
||||||
|
* [Component](http://github.com/component/component): `components/handlebars.js`
|
||||||
|
* [Composer](http://packagist.org/packages/components/handlebars.js): `components/handlebars.js`
|
||||||
|
* [jspm](http://jspm.io): `github:components/handlebars.js`
|
||||||
7
docs/bower_components/handlebars/bower.json
vendored
Normal file
7
docs/bower_components/handlebars/bower.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "handlebars",
|
||||||
|
"version": "4.7.6",
|
||||||
|
"main": "handlebars.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
9
docs/bower_components/handlebars/component.json
vendored
Normal file
9
docs/bower_components/handlebars/component.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "handlebars",
|
||||||
|
"repo": "components/handlebars.js",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "handlebars.js",
|
||||||
|
"scripts": [
|
||||||
|
"handlebars.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
35
docs/bower_components/handlebars/composer.json
vendored
Normal file
35
docs/bower_components/handlebars/composer.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "components/handlebars.js",
|
||||||
|
"description": "Handlebars.js and Mustache are both logicless templating languages that keep the view and the code separated like we all know they should be.",
|
||||||
|
"homepage": "http://handlebarsjs.com",
|
||||||
|
"license": "MIT",
|
||||||
|
"type": "component",
|
||||||
|
"keywords": [
|
||||||
|
"handlebars",
|
||||||
|
"mustache",
|
||||||
|
"html"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Chris Wanstrath",
|
||||||
|
"homepage": "http://chriswanstrath.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"robloach/component-installer": "*"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"component": {
|
||||||
|
"name": "handlebars",
|
||||||
|
"scripts": [
|
||||||
|
"handlebars.js"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"handlebars.runtime.js"
|
||||||
|
],
|
||||||
|
"shim": {
|
||||||
|
"exports": "Handlebars"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
docs/bower_components/handlebars/handlebars-source-4.4.3.gem
vendored
Normal file
BIN
docs/bower_components/handlebars/handlebars-source-4.4.3.gem
vendored
Normal file
Binary file not shown.
22
docs/bower_components/handlebars/handlebars-source.gemspec
vendored
Normal file
22
docs/bower_components/handlebars/handlebars-source.gemspec
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
package = JSON.parse(File.read('bower.json'))
|
||||||
|
|
||||||
|
Gem::Specification.new do |gem|
|
||||||
|
gem.name = "handlebars-source"
|
||||||
|
gem.authors = ["Yehuda Katz"]
|
||||||
|
gem.email = ["wycats@gmail.com"]
|
||||||
|
gem.date = Time.now.strftime("%Y-%m-%d")
|
||||||
|
gem.description = %q{Handlebars.js source code wrapper for (pre)compilation gems.}
|
||||||
|
gem.summary = %q{Handlebars.js source code wrapper}
|
||||||
|
gem.homepage = "https://github.com/wycats/handlebars.js/"
|
||||||
|
gem.version = package["version"].sub "-", "."
|
||||||
|
gem.license = "MIT"
|
||||||
|
|
||||||
|
gem.files = [
|
||||||
|
'handlebars.js',
|
||||||
|
'handlebars.runtime.js',
|
||||||
|
'lib/handlebars/source.rb'
|
||||||
|
]
|
||||||
|
end
|
||||||
4624
docs/bower_components/handlebars/handlebars.amd.js
vendored
Normal file
4624
docs/bower_components/handlebars/handlebars.amd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
29
docs/bower_components/handlebars/handlebars.amd.min.js
vendored
Normal file
29
docs/bower_components/handlebars/handlebars.amd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5210
docs/bower_components/handlebars/handlebars.js
vendored
Normal file
5210
docs/bower_components/handlebars/handlebars.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
docs/bower_components/handlebars/handlebars.js.nuspec
vendored
Normal file
17
docs/bower_components/handlebars/handlebars.js.nuspec
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<package>
|
||||||
|
<metadata>
|
||||||
|
<id>handlebars.js</id>
|
||||||
|
<version>4.7.6</version>
|
||||||
|
<authors>handlebars.js Authors</authors>
|
||||||
|
<licenseUrl>https://github.com/wycats/handlebars.js/blob/master/LICENSE</licenseUrl>
|
||||||
|
<projectUrl>https://github.com/wycats/handlebars.js/</projectUrl>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>Extension of the Mustache logicless template language</description>
|
||||||
|
<releaseNotes></releaseNotes>
|
||||||
|
<tags>handlebars mustache template html</tags>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="handlebars.js" target="Content\Scripts" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
29
docs/bower_components/handlebars/handlebars.min.js
vendored
Normal file
29
docs/bower_components/handlebars/handlebars.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1286
docs/bower_components/handlebars/handlebars.runtime.amd.js
vendored
Normal file
1286
docs/bower_components/handlebars/handlebars.runtime.amd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
27
docs/bower_components/handlebars/handlebars.runtime.amd.min.js
vendored
Normal file
27
docs/bower_components/handlebars/handlebars.runtime.amd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1800
docs/bower_components/handlebars/handlebars.runtime.js
vendored
Normal file
1800
docs/bower_components/handlebars/handlebars.runtime.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27
docs/bower_components/handlebars/handlebars.runtime.min.js
vendored
Normal file
27
docs/bower_components/handlebars/handlebars.runtime.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
docs/bower_components/handlebars/lib/handlebars/source.rb
vendored
Normal file
11
docs/bower_components/handlebars/lib/handlebars/source.rb
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module Handlebars
|
||||||
|
module Source
|
||||||
|
def self.bundled_path
|
||||||
|
File.expand_path("../../../handlebars.js", __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.runtime_bundled_path
|
||||||
|
File.expand_path("../../../handlebars.runtime.js", __FILE__)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
20
docs/bower_components/handlebars/package.json
vendored
Normal file
20
docs/bower_components/handlebars/package.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "handlebars",
|
||||||
|
"version": "4.7.6",
|
||||||
|
"license": "MIT",
|
||||||
|
"jspm": {
|
||||||
|
"main": "handlebars",
|
||||||
|
"shim": {
|
||||||
|
"handlebars": {
|
||||||
|
"exports": "Handlebars"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"handlebars.js",
|
||||||
|
"handlebars.runtime.js"
|
||||||
|
],
|
||||||
|
"buildConfig": {
|
||||||
|
"minify": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
docs/bower_components/jquery/.bower.json
vendored
Normal file
25
docs/bower_components/jquery/.bower.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "jquery",
|
||||||
|
"main": "dist/jquery.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"jquery",
|
||||||
|
"javascript",
|
||||||
|
"browser",
|
||||||
|
"library"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jquery/jquery-dist",
|
||||||
|
"version": "2.2.4",
|
||||||
|
"_release": "2.2.4",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "2.2.4",
|
||||||
|
"commit": "c0185ab7c75aab88762c5aae780b9d83b80eda72"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/jquery/jquery-dist.git",
|
||||||
|
"_target": "^2.2.4",
|
||||||
|
"_originalSource": "jquery"
|
||||||
|
}
|
||||||
278
docs/bower_components/jquery/AUTHORS.txt
vendored
Normal file
278
docs/bower_components/jquery/AUTHORS.txt
vendored
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
Authors ordered by first contribution.
|
||||||
|
|
||||||
|
John Resig <jeresig@gmail.com>
|
||||||
|
Gilles van den Hoven <gilles0181@gmail.com>
|
||||||
|
Michael Geary <mike@geary.com>
|
||||||
|
Stefan Petre <stefan.petre@gmail.com>
|
||||||
|
Yehuda Katz <wycats@gmail.com>
|
||||||
|
Corey Jewett <cj@syntheticplayground.com>
|
||||||
|
Klaus Hartl <klaus.hartl@gmail.com>
|
||||||
|
Franck Marcia <franck.marcia@gmail.com>
|
||||||
|
Jörn Zaefferer <joern.zaefferer@gmail.com>
|
||||||
|
Paul Bakaus <paul.bakaus@gmail.com>
|
||||||
|
Brandon Aaron <brandon.aaron@gmail.com>
|
||||||
|
Mike Alsup <malsup@gmail.com>
|
||||||
|
Dave Methvin <dave.methvin@gmail.com>
|
||||||
|
Ed Engelhardt <edengelhardt@gmail.com>
|
||||||
|
Sean Catchpole <littlecooldude@gmail.com>
|
||||||
|
Paul Mclanahan <pmclanahan@gmail.com>
|
||||||
|
David Serduke <davidserduke@gmail.com>
|
||||||
|
Richard D. Worth <rdworth@gmail.com>
|
||||||
|
Scott González <scott.gonzalez@gmail.com>
|
||||||
|
Ariel Flesler <aflesler@gmail.com>
|
||||||
|
Jon Evans <jon@springyweb.com>
|
||||||
|
TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
Michael Bensoussan <mickey@seesmic.com>
|
||||||
|
Robert Katić <robert.katic@gmail.com>
|
||||||
|
Louis-Rémi Babé <lrbabe@gmail.com>
|
||||||
|
Earle Castledine <mrspeaker@gmail.com>
|
||||||
|
Damian Janowski <damian.janowski@gmail.com>
|
||||||
|
Rich Dougherty <rich@rd.gen.nz>
|
||||||
|
Kim Dalsgaard <kim@kimdalsgaard.com>
|
||||||
|
Andrea Giammarchi <andrea.giammarchi@gmail.com>
|
||||||
|
Mark Gibson <jollytoad@gmail.com>
|
||||||
|
Karl Swedberg <kswedberg@gmail.com>
|
||||||
|
Justin Meyer <justinbmeyer@gmail.com>
|
||||||
|
Ben Alman <cowboy@rj3.net>
|
||||||
|
James Padolsey <cla@padolsey.net>
|
||||||
|
David Petersen <public@petersendidit.com>
|
||||||
|
Batiste Bieler <batiste.bieler@gmail.com>
|
||||||
|
Alexander Farkas <info@corrupt-system.de>
|
||||||
|
Rick Waldron <waldron.rick@gmail.com>
|
||||||
|
Filipe Fortes <filipe@fortes.com>
|
||||||
|
Neeraj Singh <neerajdotname@gmail.com>
|
||||||
|
Paul Irish <paul.irish@gmail.com>
|
||||||
|
Iraê Carvalho <irae@irae.pro.br>
|
||||||
|
Matt Curry <matt@pseudocoder.com>
|
||||||
|
Michael Monteleone <michael@michaelmonteleone.net>
|
||||||
|
Noah Sloan <noah.sloan@gmail.com>
|
||||||
|
Tom Viner <github@viner.tv>
|
||||||
|
Douglas Neiner <doug@dougneiner.com>
|
||||||
|
Adam J. Sontag <ajpiano@ajpiano.com>
|
||||||
|
Dave Reed <dareed@microsoft.com>
|
||||||
|
Ralph Whitbeck <ralph.whitbeck@gmail.com>
|
||||||
|
Carl Fürstenberg <azatoth@gmail.com>
|
||||||
|
Jacob Wright <jacwright@gmail.com>
|
||||||
|
J. Ryan Stinnett <jryans@gmail.com>
|
||||||
|
unknown <Igen005@.upcorp.ad.uprr.com>
|
||||||
|
temp01 <temp01irc@gmail.com>
|
||||||
|
Heungsub Lee <h@subl.ee>
|
||||||
|
Colin Snover <github.com@zetafleet.com>
|
||||||
|
Ryan W Tenney <ryan@10e.us>
|
||||||
|
Pinhook <contact@pinhooklabs.com>
|
||||||
|
Ron Otten <r.j.g.otten@gmail.com>
|
||||||
|
Jephte Clain <Jephte.Clain@univ-reunion.fr>
|
||||||
|
Anton Matzneller <obhvsbypqghgc@gmail.com>
|
||||||
|
Alex Sexton <AlexSexton@gmail.com>
|
||||||
|
Dan Heberden <danheberden@gmail.com>
|
||||||
|
Henri Wiechers <hwiechers@gmail.com>
|
||||||
|
Russell Holbrook <russell.holbrook@patch.com>
|
||||||
|
Julian Aubourg <aubourg.julian@gmail.com>
|
||||||
|
Gianni Alessandro Chiappetta <gianni@runlevel6.org>
|
||||||
|
Scott Jehl <scottjehl@gmail.com>
|
||||||
|
James Burke <jrburke@gmail.com>
|
||||||
|
Jonas Pfenniger <jonas@pfenniger.name>
|
||||||
|
Xavi Ramirez <xavi.rmz@gmail.com>
|
||||||
|
Jared Grippe <jared@deadlyicon.com>
|
||||||
|
Sylvester Keil <sylvester@keil.or.at>
|
||||||
|
Brandon Sterne <bsterne@mozilla.com>
|
||||||
|
Mathias Bynens <mathias@qiwi.be>
|
||||||
|
Timmy Willison <timmywillisn@gmail.com>
|
||||||
|
Corey Frang <gnarf37@gmail.com>
|
||||||
|
Digitalxero <digitalxero>
|
||||||
|
Anton Kovalyov <anton@kovalyov.net>
|
||||||
|
David Murdoch <david@davidmurdoch.com>
|
||||||
|
Josh Varner <josh.varner@gmail.com>
|
||||||
|
Charles McNulty <cmcnulty@kznf.com>
|
||||||
|
Jordan Boesch <jboesch26@gmail.com>
|
||||||
|
Jess Thrysoee <jess@thrysoee.dk>
|
||||||
|
Michael Murray <m@murz.net>
|
||||||
|
Lee Carpenter <elcarpie@gmail.com>
|
||||||
|
Alexis Abril <me@alexisabril.com>
|
||||||
|
Rob Morgan <robbym@gmail.com>
|
||||||
|
John Firebaugh <john_firebaugh@bigfix.com>
|
||||||
|
Sam Bisbee <sam@sbisbee.com>
|
||||||
|
Gilmore Davidson <gilmoreorless@gmail.com>
|
||||||
|
Brian Brennan <me@brianlovesthings.com>
|
||||||
|
Xavier Montillet <xavierm02.net@gmail.com>
|
||||||
|
Daniel Pihlstrom <sciolist.se@gmail.com>
|
||||||
|
Sahab Yazdani <sahab.yazdani+github@gmail.com>
|
||||||
|
avaly <github-com@agachi.name>
|
||||||
|
Scott Hughes <hi@scott-hughes.me>
|
||||||
|
Mike Sherov <mike.sherov@gmail.com>
|
||||||
|
Greg Hazel <ghazel@gmail.com>
|
||||||
|
Schalk Neethling <schalk@ossreleasefeed.com>
|
||||||
|
Denis Knauf <Denis.Knauf@gmail.com>
|
||||||
|
Timo Tijhof <krinklemail@gmail.com>
|
||||||
|
Steen Nielsen <swinedk@gmail.com>
|
||||||
|
Anton Ryzhov <anton@ryzhov.me>
|
||||||
|
Shi Chuan <shichuanr@gmail.com>
|
||||||
|
Berker Peksag <berker.peksag@gmail.com>
|
||||||
|
Toby Brain <tobyb@freshview.com>
|
||||||
|
Matt Mueller <mattmuelle@gmail.com>
|
||||||
|
Justin <drakefjustin@gmail.com>
|
||||||
|
Daniel Herman <daniel.c.herman@gmail.com>
|
||||||
|
Oleg Gaidarenko <markelog@gmail.com>
|
||||||
|
Richard Gibson <richard.gibson@gmail.com>
|
||||||
|
Rafaël Blais Masson <rafbmasson@gmail.com>
|
||||||
|
cmc3cn <59194618@qq.com>
|
||||||
|
Joe Presbrey <presbrey@gmail.com>
|
||||||
|
Sindre Sorhus <sindresorhus@gmail.com>
|
||||||
|
Arne de Bree <arne@bukkie.nl>
|
||||||
|
Vladislav Zarakovsky <vlad.zar@gmail.com>
|
||||||
|
Andrew E Monat <amonat@gmail.com>
|
||||||
|
Oskari <admin@o-programs.com>
|
||||||
|
Joao Henrique de Andrade Bruni <joaohbruni@yahoo.com.br>
|
||||||
|
tsinha <tsinha@Anthonys-MacBook-Pro.local>
|
||||||
|
Matt Farmer <matt@frmr.me>
|
||||||
|
Trey Hunner <treyhunner@gmail.com>
|
||||||
|
Jason Moon <jmoon@socialcast.com>
|
||||||
|
Jeffery To <jeffery.to@gmail.com>
|
||||||
|
Kris Borchers <kris.borchers@gmail.com>
|
||||||
|
Vladimir Zhuravlev <private.face@gmail.com>
|
||||||
|
Jacob Thornton <jacobthornton@gmail.com>
|
||||||
|
Chad Killingsworth <chadkillingsworth@missouristate.edu>
|
||||||
|
Nowres Rafid <nowres.rafed@gmail.com>
|
||||||
|
David Benjamin <davidben@mit.edu>
|
||||||
|
Uri Gilad <antishok@gmail.com>
|
||||||
|
Chris Faulkner <thefaulkner@gmail.com>
|
||||||
|
Elijah Manor <elijah.manor@gmail.com>
|
||||||
|
Daniel Chatfield <chatfielddaniel@gmail.com>
|
||||||
|
Nikita Govorov <nikita.govorov@gmail.com>
|
||||||
|
Wesley Walser <waw325@gmail.com>
|
||||||
|
Mike Pennisi <mike@mikepennisi.com>
|
||||||
|
Markus Staab <markus.staab@redaxo.de>
|
||||||
|
Dave Riddle <david@joyvuu.com>
|
||||||
|
Callum Macrae <callum@lynxphp.com>
|
||||||
|
Benjamin Truyman <bentruyman@gmail.com>
|
||||||
|
James Huston <james@jameshuston.net>
|
||||||
|
Erick Ruiz de Chávez <erickrdch@gmail.com>
|
||||||
|
David Bonner <dbonner@cogolabs.com>
|
||||||
|
Akintayo Akinwunmi <aakinwunmi@judge.com>
|
||||||
|
MORGAN <morgan@morgangraphics.com>
|
||||||
|
Ismail Khair <ismail.khair@gmail.com>
|
||||||
|
Carl Danley <carldanley@gmail.com>
|
||||||
|
Mike Petrovich <michael.c.petrovich@gmail.com>
|
||||||
|
Greg Lavallee <greglavallee@wapolabs.com>
|
||||||
|
Daniel Gálvez <dgalvez@editablething.com>
|
||||||
|
Sai Lung Wong <sai.wong@huffingtonpost.com>
|
||||||
|
Tom H Fuertes <TomFuertes@gmail.com>
|
||||||
|
Roland Eckl <eckl.roland@googlemail.com>
|
||||||
|
Jay Merrifield <fracmak@gmail.com>
|
||||||
|
Allen J Schmidt Jr <cobrasoft@gmail.com>
|
||||||
|
Jonathan Sampson <jjdsampson@gmail.com>
|
||||||
|
Marcel Greter <marcel.greter@ocbnet.ch>
|
||||||
|
Matthias Jäggli <matthias.jaeggli@gmail.com>
|
||||||
|
David Fox <dfoxinator@gmail.com>
|
||||||
|
Yiming He <yiminghe@gmail.com>
|
||||||
|
Devin Cooper <cooper.semantics@gmail.com>
|
||||||
|
Paul Ramos <paul.b.ramos@gmail.com>
|
||||||
|
Rod Vagg <rod@vagg.org>
|
||||||
|
Bennett Sorbo <bsorbo@gmail.com>
|
||||||
|
Sebastian Burkhard <sebi.burkhard@gmail.com>
|
||||||
|
Zachary Adam Kaplan <razic@viralkitty.com>
|
||||||
|
nanto_vi <nanto@moon.email.ne.jp>
|
||||||
|
nanto <nanto@moon.email.ne.jp>
|
||||||
|
Danil Somsikov <danilasomsikov@gmail.com>
|
||||||
|
Ryunosuke SATO <tricknotes.rs@gmail.com>
|
||||||
|
Jean Boussier <jean.boussier@gmail.com>
|
||||||
|
Adam Coulombe <me@adam.co>
|
||||||
|
Andrew Plummer <plummer.andrew@gmail.com>
|
||||||
|
Mark Raddatz <mraddatz@gmail.com>
|
||||||
|
Isaac Z. Schlueter <i@izs.me>
|
||||||
|
Karl Sieburg <ksieburg@yahoo.com>
|
||||||
|
Pascal Borreli <pascal@borreli.com>
|
||||||
|
Nguyen Phuc Lam <ruado1987@gmail.com>
|
||||||
|
Dmitry Gusev <dmitry.gusev@gmail.com>
|
||||||
|
Michał Gołębiowski <m.goleb@gmail.com>
|
||||||
|
Li Xudong <istonelee@gmail.com>
|
||||||
|
Steven Benner <admin@stevenbenner.com>
|
||||||
|
Tom H Fuertes <tomfuertes@gmail.com>
|
||||||
|
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
|
||||||
|
ros3cin <ros3@cin.ufpe.br>
|
||||||
|
Jason Bedard <jason+jquery@jbedard.ca>
|
||||||
|
Kyle Robinson Young <kyle@dontkry.com>
|
||||||
|
Chris Talkington <chris@talkingtontech.com>
|
||||||
|
Eddie Monge <eddie@eddiemonge.com>
|
||||||
|
Terry Jones <terry@jon.es>
|
||||||
|
Jason Merino <jasonmerino@gmail.com>
|
||||||
|
Jeremy Dunck <jdunck@gmail.com>
|
||||||
|
Chris Price <price.c@gmail.com>
|
||||||
|
Guy Bedford <guybedford@gmail.com>
|
||||||
|
Amey Sakhadeo <me@ameyms.com>
|
||||||
|
Mike Sidorov <mikes.ekb@gmail.com>
|
||||||
|
Anthony Ryan <anthonyryan1@gmail.com>
|
||||||
|
Dominik D. Geyer <dominik.geyer@gmail.com>
|
||||||
|
George Kats <katsgeorgeek@gmail.com>
|
||||||
|
Lihan Li <frankieteardrop@gmail.com>
|
||||||
|
Ronny Springer <springer.ronny@gmail.com>
|
||||||
|
Chris Antaki <ChrisAntaki@gmail.com>
|
||||||
|
Marian Sollmann <marian.sollmann@cargomedia.ch>
|
||||||
|
njhamann <njhamann@gmail.com>
|
||||||
|
Ilya Kantor <iliakan@gmail.com>
|
||||||
|
David Hong <d.hong@me.com>
|
||||||
|
John Paul <john@johnkpaul.com>
|
||||||
|
Jakob Stoeck <jakob@pokermania.de>
|
||||||
|
Christopher Jones <chris@cjqed.com>
|
||||||
|
Forbes Lindesay <forbes@lindesay.co.uk>
|
||||||
|
S. Andrew Sheppard <andrew@wq.io>
|
||||||
|
Leonardo Balter <leonardo.balter@gmail.com>
|
||||||
|
Roman Reiß <me@silverwind.io>
|
||||||
|
Benjy Cui <benjytrys@gmail.com>
|
||||||
|
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
|
||||||
|
John Hoven <hovenj@gmail.com>
|
||||||
|
Philip Jägenstedt <philip@foolip.org>
|
||||||
|
Christian Kosmowski <ksmwsk@gmail.com>
|
||||||
|
Liang Peng <poppinlp@gmail.com>
|
||||||
|
TJ VanToll <tj.vantoll@gmail.com>
|
||||||
|
Senya Pugach <upisfree@outlook.com>
|
||||||
|
Aurelio De Rosa <aurelioderosa@gmail.com>
|
||||||
|
Nazar Mokrynskyi <nazar@mokrynskyi.com>
|
||||||
|
Amit Merchant <bullredeyes@gmail.com>
|
||||||
|
Jason Bedard <jason+github@jbedard.ca>
|
||||||
|
Arthur Verschaeve <contact@arthurverschaeve.be>
|
||||||
|
Dan Hart <danhart@notonthehighstreet.com>
|
||||||
|
Bin Xin <rhyzix@gmail.com>
|
||||||
|
David Corbacho <davidcorbacho@gmail.com>
|
||||||
|
Veaceslav Grimalschi <grimalschi@yandex.ru>
|
||||||
|
Daniel Husar <dano.husar@gmail.com>
|
||||||
|
Frederic Hemberger <mail@frederic-hemberger.de>
|
||||||
|
Ben Toews <mastahyeti@gmail.com>
|
||||||
|
Aditya Raghavan <araghavan3@gmail.com>
|
||||||
|
Victor Homyakov <vkhomyackov@gmail.com>
|
||||||
|
Shivaji Varma <contact@shivajivarma.com>
|
||||||
|
Nicolas HENRY <icewil@gmail.com>
|
||||||
|
Anne-Gaelle Colom <coloma@westminster.ac.uk>
|
||||||
|
George Mauer <gmauer@gmail.com>
|
||||||
|
Leonardo Braga <leonardo.braga@gmail.com>
|
||||||
|
Stephen Edgar <stephen@netweb.com.au>
|
||||||
|
Thomas Tortorini <thomastortorini@gmail.com>
|
||||||
|
Winston Howes <winstonhowes@gmail.com>
|
||||||
|
Jon Hester <jon.d.hester@gmail.com>
|
||||||
|
Alexander O'Mara <me@alexomara.com>
|
||||||
|
Bastian Buchholz <buchholz.bastian@googlemail.com>
|
||||||
|
Arthur Stolyar <nekr.fabula@gmail.com>
|
||||||
|
Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||||
|
Mu Haibao <mhbseal@163.com>
|
||||||
|
Richard McDaniel <rm0026@uah.edu>
|
||||||
|
Chris Rebert <github@rebertia.com>
|
||||||
|
Gabriel Schulhof <gabriel.schulhof@intel.com>
|
||||||
|
Gilad Peleg <giladp007@gmail.com>
|
||||||
|
Martin Naumann <martin@geekonaut.de>
|
||||||
|
Marek Lewandowski <m.lewandowski@cksource.com>
|
||||||
|
Bruno Pérel <brunoperel@gmail.com>
|
||||||
|
Reed Loden <reed@reedloden.com>
|
||||||
|
Daniel Nill <daniellnill@gmail.com>
|
||||||
|
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
|
||||||
|
Sean Henderson <seanh.za@gmail.com>
|
||||||
|
Richard Kraaijenhagen <stdin+git@riichard.com>
|
||||||
|
Connor Atherton <c.liam.atherton@gmail.com>
|
||||||
|
Gary Ye <garysye@gmail.com>
|
||||||
|
Christian Grete <webmaster@christiangrete.com>
|
||||||
|
Liza Ramo <liza.h.ramo@gmail.com>
|
||||||
|
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
|
||||||
|
Joelle Fleurantin <joasqueeniebee@gmail.com>
|
||||||
|
Jun Sun <klsforever@gmail.com>
|
||||||
|
Devin Wilson <dwilson6.github@gmail.com>
|
||||||
|
Todor Prikumov <tono_pr@abv.bg>
|
||||||
|
Zack Hall <zackhall@outlook.com>
|
||||||
36
docs/bower_components/jquery/LICENSE.txt
vendored
Normal file
36
docs/bower_components/jquery/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||||
|
|
||||||
|
This software consists of voluntary contributions made by many
|
||||||
|
individuals. For exact contribution history, see the revision history
|
||||||
|
available at https://github.com/jquery/jquery
|
||||||
|
|
||||||
|
The following license applies to all parts of this software except as
|
||||||
|
documented below:
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
All files located in the node_modules and external directories are
|
||||||
|
externally maintained libraries used by this software which have their
|
||||||
|
own licenses; we recommend you read them, as their terms may differ from
|
||||||
|
the terms above.
|
||||||
65
docs/bower_components/jquery/README.md
vendored
Normal file
65
docs/bower_components/jquery/README.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# jQuery
|
||||||
|
|
||||||
|
> jQuery is a fast, small, and feature-rich JavaScript library.
|
||||||
|
|
||||||
|
For information on how to get started and how to use jQuery, please see [jQuery's documentation](http://api.jquery.com/).
|
||||||
|
For source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery).
|
||||||
|
|
||||||
|
## Including jQuery
|
||||||
|
|
||||||
|
Below are some of the most common ways to include jQuery.
|
||||||
|
|
||||||
|
### Browser
|
||||||
|
|
||||||
|
#### Script tag
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Babel
|
||||||
|
|
||||||
|
[Babel](http://babeljs.io/) is a next generation JavaScript compiler. One of the features is the ability to use ES6/ES2015 modules now, even though browsers do not yet support this feature natively.
|
||||||
|
|
||||||
|
```js
|
||||||
|
import $ from "jquery";
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Browserify/Webpack
|
||||||
|
|
||||||
|
There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documention. In the script, including jQuery will usually look like this...
|
||||||
|
|
||||||
|
```js
|
||||||
|
var $ = require("jquery");
|
||||||
|
```
|
||||||
|
|
||||||
|
#### AMD (Asynchronous Module Definition)
|
||||||
|
|
||||||
|
AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](http://requirejs.org/docs/whyamd.html).
|
||||||
|
|
||||||
|
```js
|
||||||
|
define(["jquery"], function($) {
|
||||||
|
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node
|
||||||
|
|
||||||
|
To include jQuery in [Node](nodejs.org), first install with npm.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install jquery
|
||||||
|
```
|
||||||
|
|
||||||
|
For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/tmpvar/jsdom). This can be useful for testing purposes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require("jsdom").env("", function(err, window) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $ = require("jquery")(window);
|
||||||
|
});
|
||||||
|
```
|
||||||
14
docs/bower_components/jquery/bower.json
vendored
Normal file
14
docs/bower_components/jquery/bower.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "jquery",
|
||||||
|
"main": "dist/jquery.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"jquery",
|
||||||
|
"javascript",
|
||||||
|
"browser",
|
||||||
|
"library"
|
||||||
|
]
|
||||||
|
}
|
||||||
9814
docs/bower_components/jquery/dist/jquery.js
vendored
Normal file
9814
docs/bower_components/jquery/dist/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
docs/bower_components/jquery/dist/jquery.min.js
vendored
Normal file
4
docs/bower_components/jquery/dist/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/jquery/dist/jquery.min.map
vendored
Normal file
1
docs/bower_components/jquery/dist/jquery.min.map
vendored
Normal file
File diff suppressed because one or more lines are too long
36
docs/bower_components/jquery/external/sizzle/LICENSE.txt
vendored
Normal file
36
docs/bower_components/jquery/external/sizzle/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||||
|
|
||||||
|
This software consists of voluntary contributions made by many
|
||||||
|
individuals. For exact contribution history, see the revision history
|
||||||
|
available at https://github.com/jquery/sizzle
|
||||||
|
|
||||||
|
The following license applies to all parts of this software except as
|
||||||
|
documented below:
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
All files located in the node_modules and external directories are
|
||||||
|
externally maintained libraries used by this software which have their
|
||||||
|
own licenses; we recommend you read them, as their terms may differ from
|
||||||
|
the terms above.
|
||||||
2143
docs/bower_components/jquery/external/sizzle/dist/sizzle.js
vendored
Normal file
2143
docs/bower_components/jquery/external/sizzle/dist/sizzle.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
docs/bower_components/jquery/external/sizzle/dist/sizzle.min.js
vendored
Normal file
3
docs/bower_components/jquery/external/sizzle/dist/sizzle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/bower_components/jquery/external/sizzle/dist/sizzle.min.map
vendored
Normal file
1
docs/bower_components/jquery/external/sizzle/dist/sizzle.min.map
vendored
Normal file
File diff suppressed because one or more lines are too long
29
docs/bower_components/jquery/src/.jshintrc
vendored
Normal file
29
docs/bower_components/jquery/src/.jshintrc
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"boss": true,
|
||||||
|
"curly": true,
|
||||||
|
"eqeqeq": true,
|
||||||
|
"eqnull": true,
|
||||||
|
"expr": true,
|
||||||
|
"immed": true,
|
||||||
|
"noarg": true,
|
||||||
|
"quotmark": "double",
|
||||||
|
"undef": true,
|
||||||
|
"unused": true,
|
||||||
|
|
||||||
|
"sub": true,
|
||||||
|
|
||||||
|
// Support: IE < 10, Android < 4.1
|
||||||
|
// The above browsers are failing a lot of tests in the ES5
|
||||||
|
// test suite at http://test262.ecmascript.org.
|
||||||
|
"es3": true,
|
||||||
|
|
||||||
|
"globals": {
|
||||||
|
"window": true,
|
||||||
|
"JSON": false,
|
||||||
|
|
||||||
|
"jQuery": true,
|
||||||
|
"define": true,
|
||||||
|
"module": true,
|
||||||
|
"noGlobal": true
|
||||||
|
}
|
||||||
|
}
|
||||||
845
docs/bower_components/jquery/src/ajax.js
vendored
Normal file
845
docs/bower_components/jquery/src/ajax.js
vendored
Normal file
@@ -0,0 +1,845 @@
|
|||||||
|
define( [
|
||||||
|
"./core",
|
||||||
|
"./var/document",
|
||||||
|
"./var/rnotwhite",
|
||||||
|
"./ajax/var/location",
|
||||||
|
"./ajax/var/nonce",
|
||||||
|
"./ajax/var/rquery",
|
||||||
|
|
||||||
|
"./core/init",
|
||||||
|
"./ajax/parseJSON",
|
||||||
|
"./ajax/parseXML",
|
||||||
|
"./event/trigger",
|
||||||
|
"./deferred"
|
||||||
|
], function( jQuery, document, rnotwhite, location, nonce, rquery ) {
|
||||||
|
|
||||||
|
var
|
||||||
|
rhash = /#.*$/,
|
||||||
|
rts = /([?&])_=[^&]*/,
|
||||||
|
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
|
||||||
|
|
||||||
|
// #7653, #8125, #8152: local protocol detection
|
||||||
|
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
|
||||||
|
rnoContent = /^(?:GET|HEAD)$/,
|
||||||
|
rprotocol = /^\/\//,
|
||||||
|
|
||||||
|
/* Prefilters
|
||||||
|
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
||||||
|
* 2) These are called:
|
||||||
|
* - BEFORE asking for a transport
|
||||||
|
* - AFTER param serialization (s.data is a string if s.processData is true)
|
||||||
|
* 3) key is the dataType
|
||||||
|
* 4) the catchall symbol "*" can be used
|
||||||
|
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
||||||
|
*/
|
||||||
|
prefilters = {},
|
||||||
|
|
||||||
|
/* Transports bindings
|
||||||
|
* 1) key is the dataType
|
||||||
|
* 2) the catchall symbol "*" can be used
|
||||||
|
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
||||||
|
*/
|
||||||
|
transports = {},
|
||||||
|
|
||||||
|
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
||||||
|
allTypes = "*/".concat( "*" ),
|
||||||
|
|
||||||
|
// Anchor tag for parsing the document origin
|
||||||
|
originAnchor = document.createElement( "a" );
|
||||||
|
originAnchor.href = location.href;
|
||||||
|
|
||||||
|
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
||||||
|
function addToPrefiltersOrTransports( structure ) {
|
||||||
|
|
||||||
|
// dataTypeExpression is optional and defaults to "*"
|
||||||
|
return function( dataTypeExpression, func ) {
|
||||||
|
|
||||||
|
if ( typeof dataTypeExpression !== "string" ) {
|
||||||
|
func = dataTypeExpression;
|
||||||
|
dataTypeExpression = "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataType,
|
||||||
|
i = 0,
|
||||||
|
dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
|
||||||
|
|
||||||
|
if ( jQuery.isFunction( func ) ) {
|
||||||
|
|
||||||
|
// For each dataType in the dataTypeExpression
|
||||||
|
while ( ( dataType = dataTypes[ i++ ] ) ) {
|
||||||
|
|
||||||
|
// Prepend if requested
|
||||||
|
if ( dataType[ 0 ] === "+" ) {
|
||||||
|
dataType = dataType.slice( 1 ) || "*";
|
||||||
|
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
|
||||||
|
|
||||||
|
// Otherwise append
|
||||||
|
} else {
|
||||||
|
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Base inspection function for prefilters and transports
|
||||||
|
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
||||||
|
|
||||||
|
var inspected = {},
|
||||||
|
seekingTransport = ( structure === transports );
|
||||||
|
|
||||||
|
function inspect( dataType ) {
|
||||||
|
var selected;
|
||||||
|
inspected[ dataType ] = true;
|
||||||
|
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
|
||||||
|
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
|
||||||
|
if ( typeof dataTypeOrTransport === "string" &&
|
||||||
|
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
|
||||||
|
|
||||||
|
options.dataTypes.unshift( dataTypeOrTransport );
|
||||||
|
inspect( dataTypeOrTransport );
|
||||||
|
return false;
|
||||||
|
} else if ( seekingTransport ) {
|
||||||
|
return !( selected = dataTypeOrTransport );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// A special extend for ajax options
|
||||||
|
// that takes "flat" options (not to be deep extended)
|
||||||
|
// Fixes #9887
|
||||||
|
function ajaxExtend( target, src ) {
|
||||||
|
var key, deep,
|
||||||
|
flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
||||||
|
|
||||||
|
for ( key in src ) {
|
||||||
|
if ( src[ key ] !== undefined ) {
|
||||||
|
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( deep ) {
|
||||||
|
jQuery.extend( true, target, deep );
|
||||||
|
}
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handles responses to an ajax request:
|
||||||
|
* - finds the right dataType (mediates between content-type and expected dataType)
|
||||||
|
* - returns the corresponding response
|
||||||
|
*/
|
||||||
|
function ajaxHandleResponses( s, jqXHR, responses ) {
|
||||||
|
|
||||||
|
var ct, type, finalDataType, firstDataType,
|
||||||
|
contents = s.contents,
|
||||||
|
dataTypes = s.dataTypes;
|
||||||
|
|
||||||
|
// Remove auto dataType and get content-type in the process
|
||||||
|
while ( dataTypes[ 0 ] === "*" ) {
|
||||||
|
dataTypes.shift();
|
||||||
|
if ( ct === undefined ) {
|
||||||
|
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we're dealing with a known content-type
|
||||||
|
if ( ct ) {
|
||||||
|
for ( type in contents ) {
|
||||||
|
if ( contents[ type ] && contents[ type ].test( ct ) ) {
|
||||||
|
dataTypes.unshift( type );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check to see if we have a response for the expected dataType
|
||||||
|
if ( dataTypes[ 0 ] in responses ) {
|
||||||
|
finalDataType = dataTypes[ 0 ];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Try convertible dataTypes
|
||||||
|
for ( type in responses ) {
|
||||||
|
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
|
||||||
|
finalDataType = type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( !firstDataType ) {
|
||||||
|
firstDataType = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or just use first one
|
||||||
|
finalDataType = finalDataType || firstDataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found a dataType
|
||||||
|
// We add the dataType to the list if needed
|
||||||
|
// and return the corresponding response
|
||||||
|
if ( finalDataType ) {
|
||||||
|
if ( finalDataType !== dataTypes[ 0 ] ) {
|
||||||
|
dataTypes.unshift( finalDataType );
|
||||||
|
}
|
||||||
|
return responses[ finalDataType ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chain conversions given the request and the original response
|
||||||
|
* Also sets the responseXXX fields on the jqXHR instance
|
||||||
|
*/
|
||||||
|
function ajaxConvert( s, response, jqXHR, isSuccess ) {
|
||||||
|
var conv2, current, conv, tmp, prev,
|
||||||
|
converters = {},
|
||||||
|
|
||||||
|
// Work with a copy of dataTypes in case we need to modify it for conversion
|
||||||
|
dataTypes = s.dataTypes.slice();
|
||||||
|
|
||||||
|
// Create converters map with lowercased keys
|
||||||
|
if ( dataTypes[ 1 ] ) {
|
||||||
|
for ( conv in s.converters ) {
|
||||||
|
converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
current = dataTypes.shift();
|
||||||
|
|
||||||
|
// Convert to each sequential dataType
|
||||||
|
while ( current ) {
|
||||||
|
|
||||||
|
if ( s.responseFields[ current ] ) {
|
||||||
|
jqXHR[ s.responseFields[ current ] ] = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply the dataFilter if provided
|
||||||
|
if ( !prev && isSuccess && s.dataFilter ) {
|
||||||
|
response = s.dataFilter( response, s.dataType );
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = current;
|
||||||
|
current = dataTypes.shift();
|
||||||
|
|
||||||
|
if ( current ) {
|
||||||
|
|
||||||
|
// There's only work to do if current dataType is non-auto
|
||||||
|
if ( current === "*" ) {
|
||||||
|
|
||||||
|
current = prev;
|
||||||
|
|
||||||
|
// Convert response if prev dataType is non-auto and differs from current
|
||||||
|
} else if ( prev !== "*" && prev !== current ) {
|
||||||
|
|
||||||
|
// Seek a direct converter
|
||||||
|
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
||||||
|
|
||||||
|
// If none found, seek a pair
|
||||||
|
if ( !conv ) {
|
||||||
|
for ( conv2 in converters ) {
|
||||||
|
|
||||||
|
// If conv2 outputs current
|
||||||
|
tmp = conv2.split( " " );
|
||||||
|
if ( tmp[ 1 ] === current ) {
|
||||||
|
|
||||||
|
// If prev can be converted to accepted input
|
||||||
|
conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
||||||
|
converters[ "* " + tmp[ 0 ] ];
|
||||||
|
if ( conv ) {
|
||||||
|
|
||||||
|
// Condense equivalence converters
|
||||||
|
if ( conv === true ) {
|
||||||
|
conv = converters[ conv2 ];
|
||||||
|
|
||||||
|
// Otherwise, insert the intermediate dataType
|
||||||
|
} else if ( converters[ conv2 ] !== true ) {
|
||||||
|
current = tmp[ 0 ];
|
||||||
|
dataTypes.unshift( tmp[ 1 ] );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply converter (if not an equivalence)
|
||||||
|
if ( conv !== true ) {
|
||||||
|
|
||||||
|
// Unless errors are allowed to bubble, catch and return them
|
||||||
|
if ( conv && s.throws ) {
|
||||||
|
response = conv( response );
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
response = conv( response );
|
||||||
|
} catch ( e ) {
|
||||||
|
return {
|
||||||
|
state: "parsererror",
|
||||||
|
error: conv ? e : "No conversion from " + prev + " to " + current
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { state: "success", data: response };
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery.extend( {
|
||||||
|
|
||||||
|
// Counter for holding the number of active queries
|
||||||
|
active: 0,
|
||||||
|
|
||||||
|
// Last-Modified header cache for next request
|
||||||
|
lastModified: {},
|
||||||
|
etag: {},
|
||||||
|
|
||||||
|
ajaxSettings: {
|
||||||
|
url: location.href,
|
||||||
|
type: "GET",
|
||||||
|
isLocal: rlocalProtocol.test( location.protocol ),
|
||||||
|
global: true,
|
||||||
|
processData: true,
|
||||||
|
async: true,
|
||||||
|
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
|
/*
|
||||||
|
timeout: 0,
|
||||||
|
data: null,
|
||||||
|
dataType: null,
|
||||||
|
username: null,
|
||||||
|
password: null,
|
||||||
|
cache: null,
|
||||||
|
throws: false,
|
||||||
|
traditional: false,
|
||||||
|
headers: {},
|
||||||
|
*/
|
||||||
|
|
||||||
|
accepts: {
|
||||||
|
"*": allTypes,
|
||||||
|
text: "text/plain",
|
||||||
|
html: "text/html",
|
||||||
|
xml: "application/xml, text/xml",
|
||||||
|
json: "application/json, text/javascript"
|
||||||
|
},
|
||||||
|
|
||||||
|
contents: {
|
||||||
|
xml: /\bxml\b/,
|
||||||
|
html: /\bhtml/,
|
||||||
|
json: /\bjson\b/
|
||||||
|
},
|
||||||
|
|
||||||
|
responseFields: {
|
||||||
|
xml: "responseXML",
|
||||||
|
text: "responseText",
|
||||||
|
json: "responseJSON"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Data converters
|
||||||
|
// Keys separate source (or catchall "*") and destination types with a single space
|
||||||
|
converters: {
|
||||||
|
|
||||||
|
// Convert anything to text
|
||||||
|
"* text": String,
|
||||||
|
|
||||||
|
// Text to html (true = no transformation)
|
||||||
|
"text html": true,
|
||||||
|
|
||||||
|
// Evaluate text as a json expression
|
||||||
|
"text json": jQuery.parseJSON,
|
||||||
|
|
||||||
|
// Parse text as xml
|
||||||
|
"text xml": jQuery.parseXML
|
||||||
|
},
|
||||||
|
|
||||||
|
// For options that shouldn't be deep extended:
|
||||||
|
// you can add your own custom options here if
|
||||||
|
// and when you create one that shouldn't be
|
||||||
|
// deep extended (see ajaxExtend)
|
||||||
|
flatOptions: {
|
||||||
|
url: true,
|
||||||
|
context: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Creates a full fledged settings object into target
|
||||||
|
// with both ajaxSettings and settings fields.
|
||||||
|
// If target is omitted, writes into ajaxSettings.
|
||||||
|
ajaxSetup: function( target, settings ) {
|
||||||
|
return settings ?
|
||||||
|
|
||||||
|
// Building a settings object
|
||||||
|
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
||||||
|
|
||||||
|
// Extending ajaxSettings
|
||||||
|
ajaxExtend( jQuery.ajaxSettings, target );
|
||||||
|
},
|
||||||
|
|
||||||
|
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
||||||
|
ajaxTransport: addToPrefiltersOrTransports( transports ),
|
||||||
|
|
||||||
|
// Main method
|
||||||
|
ajax: function( url, options ) {
|
||||||
|
|
||||||
|
// If url is an object, simulate pre-1.5 signature
|
||||||
|
if ( typeof url === "object" ) {
|
||||||
|
options = url;
|
||||||
|
url = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force options to be an object
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
var transport,
|
||||||
|
|
||||||
|
// URL without anti-cache param
|
||||||
|
cacheURL,
|
||||||
|
|
||||||
|
// Response headers
|
||||||
|
responseHeadersString,
|
||||||
|
responseHeaders,
|
||||||
|
|
||||||
|
// timeout handle
|
||||||
|
timeoutTimer,
|
||||||
|
|
||||||
|
// Url cleanup var
|
||||||
|
urlAnchor,
|
||||||
|
|
||||||
|
// To know if global events are to be dispatched
|
||||||
|
fireGlobals,
|
||||||
|
|
||||||
|
// Loop variable
|
||||||
|
i,
|
||||||
|
|
||||||
|
// Create the final options object
|
||||||
|
s = jQuery.ajaxSetup( {}, options ),
|
||||||
|
|
||||||
|
// Callbacks context
|
||||||
|
callbackContext = s.context || s,
|
||||||
|
|
||||||
|
// Context for global events is callbackContext if it is a DOM node or jQuery collection
|
||||||
|
globalEventContext = s.context &&
|
||||||
|
( callbackContext.nodeType || callbackContext.jquery ) ?
|
||||||
|
jQuery( callbackContext ) :
|
||||||
|
jQuery.event,
|
||||||
|
|
||||||
|
// Deferreds
|
||||||
|
deferred = jQuery.Deferred(),
|
||||||
|
completeDeferred = jQuery.Callbacks( "once memory" ),
|
||||||
|
|
||||||
|
// Status-dependent callbacks
|
||||||
|
statusCode = s.statusCode || {},
|
||||||
|
|
||||||
|
// Headers (they are sent all at once)
|
||||||
|
requestHeaders = {},
|
||||||
|
requestHeadersNames = {},
|
||||||
|
|
||||||
|
// The jqXHR state
|
||||||
|
state = 0,
|
||||||
|
|
||||||
|
// Default abort message
|
||||||
|
strAbort = "canceled",
|
||||||
|
|
||||||
|
// Fake xhr
|
||||||
|
jqXHR = {
|
||||||
|
readyState: 0,
|
||||||
|
|
||||||
|
// Builds headers hashtable if needed
|
||||||
|
getResponseHeader: function( key ) {
|
||||||
|
var match;
|
||||||
|
if ( state === 2 ) {
|
||||||
|
if ( !responseHeaders ) {
|
||||||
|
responseHeaders = {};
|
||||||
|
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
|
||||||
|
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match = responseHeaders[ key.toLowerCase() ];
|
||||||
|
}
|
||||||
|
return match == null ? null : match;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Raw string
|
||||||
|
getAllResponseHeaders: function() {
|
||||||
|
return state === 2 ? responseHeadersString : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Caches the header
|
||||||
|
setRequestHeader: function( name, value ) {
|
||||||
|
var lname = name.toLowerCase();
|
||||||
|
if ( !state ) {
|
||||||
|
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
|
||||||
|
requestHeaders[ name ] = value;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Overrides response content-type header
|
||||||
|
overrideMimeType: function( type ) {
|
||||||
|
if ( !state ) {
|
||||||
|
s.mimeType = type;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Status-dependent callbacks
|
||||||
|
statusCode: function( map ) {
|
||||||
|
var code;
|
||||||
|
if ( map ) {
|
||||||
|
if ( state < 2 ) {
|
||||||
|
for ( code in map ) {
|
||||||
|
|
||||||
|
// Lazy-add the new callback in a way that preserves old ones
|
||||||
|
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Execute the appropriate callbacks
|
||||||
|
jqXHR.always( map[ jqXHR.status ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Cancel the request
|
||||||
|
abort: function( statusText ) {
|
||||||
|
var finalText = statusText || strAbort;
|
||||||
|
if ( transport ) {
|
||||||
|
transport.abort( finalText );
|
||||||
|
}
|
||||||
|
done( 0, finalText );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Attach deferreds
|
||||||
|
deferred.promise( jqXHR ).complete = completeDeferred.add;
|
||||||
|
jqXHR.success = jqXHR.done;
|
||||||
|
jqXHR.error = jqXHR.fail;
|
||||||
|
|
||||||
|
// Remove hash character (#7531: and string promotion)
|
||||||
|
// Add protocol if not provided (prefilters might expect it)
|
||||||
|
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
||||||
|
// We also use the url parameter if available
|
||||||
|
s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
|
||||||
|
.replace( rprotocol, location.protocol + "//" );
|
||||||
|
|
||||||
|
// Alias method option to type as per ticket #12004
|
||||||
|
s.type = options.method || options.type || s.method || s.type;
|
||||||
|
|
||||||
|
// Extract dataTypes list
|
||||||
|
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
|
||||||
|
|
||||||
|
// A cross-domain request is in order when the origin doesn't match the current origin.
|
||||||
|
if ( s.crossDomain == null ) {
|
||||||
|
urlAnchor = document.createElement( "a" );
|
||||||
|
|
||||||
|
// Support: IE8-11+
|
||||||
|
// IE throws exception if url is malformed, e.g. http://example.com:80x/
|
||||||
|
try {
|
||||||
|
urlAnchor.href = s.url;
|
||||||
|
|
||||||
|
// Support: IE8-11+
|
||||||
|
// Anchor's host property isn't correctly set when s.url is relative
|
||||||
|
urlAnchor.href = urlAnchor.href;
|
||||||
|
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
|
||||||
|
urlAnchor.protocol + "//" + urlAnchor.host;
|
||||||
|
} catch ( e ) {
|
||||||
|
|
||||||
|
// If there is an error parsing the URL, assume it is crossDomain,
|
||||||
|
// it can be rejected by the transport if it is invalid
|
||||||
|
s.crossDomain = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert data if not already a string
|
||||||
|
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
||||||
|
s.data = jQuery.param( s.data, s.traditional );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply prefilters
|
||||||
|
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
||||||
|
|
||||||
|
// If request was aborted inside a prefilter, stop there
|
||||||
|
if ( state === 2 ) {
|
||||||
|
return jqXHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We can fire global events as of now if asked to
|
||||||
|
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
|
||||||
|
fireGlobals = jQuery.event && s.global;
|
||||||
|
|
||||||
|
// Watch for a new set of requests
|
||||||
|
if ( fireGlobals && jQuery.active++ === 0 ) {
|
||||||
|
jQuery.event.trigger( "ajaxStart" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uppercase the type
|
||||||
|
s.type = s.type.toUpperCase();
|
||||||
|
|
||||||
|
// Determine if request has content
|
||||||
|
s.hasContent = !rnoContent.test( s.type );
|
||||||
|
|
||||||
|
// Save the URL in case we're toying with the If-Modified-Since
|
||||||
|
// and/or If-None-Match header later on
|
||||||
|
cacheURL = s.url;
|
||||||
|
|
||||||
|
// More options handling for requests with no content
|
||||||
|
if ( !s.hasContent ) {
|
||||||
|
|
||||||
|
// If data is available, append data to url
|
||||||
|
if ( s.data ) {
|
||||||
|
cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
|
||||||
|
|
||||||
|
// #9682: remove data so that it's not used in an eventual retry
|
||||||
|
delete s.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add anti-cache in url if needed
|
||||||
|
if ( s.cache === false ) {
|
||||||
|
s.url = rts.test( cacheURL ) ?
|
||||||
|
|
||||||
|
// If there is already a '_' parameter, set its value
|
||||||
|
cacheURL.replace( rts, "$1_=" + nonce++ ) :
|
||||||
|
|
||||||
|
// Otherwise add one to the end
|
||||||
|
cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||||||
|
if ( s.ifModified ) {
|
||||||
|
if ( jQuery.lastModified[ cacheURL ] ) {
|
||||||
|
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
|
||||||
|
}
|
||||||
|
if ( jQuery.etag[ cacheURL ] ) {
|
||||||
|
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the correct header, if data is being sent
|
||||||
|
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
||||||
|
jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the Accepts header for the server, depending on the dataType
|
||||||
|
jqXHR.setRequestHeader(
|
||||||
|
"Accept",
|
||||||
|
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
|
||||||
|
s.accepts[ s.dataTypes[ 0 ] ] +
|
||||||
|
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
||||||
|
s.accepts[ "*" ]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check for headers option
|
||||||
|
for ( i in s.headers ) {
|
||||||
|
jqXHR.setRequestHeader( i, s.headers[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow custom headers/mimetypes and early abort
|
||||||
|
if ( s.beforeSend &&
|
||||||
|
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
|
||||||
|
|
||||||
|
// Abort if not done already and return
|
||||||
|
return jqXHR.abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aborting is no longer a cancellation
|
||||||
|
strAbort = "abort";
|
||||||
|
|
||||||
|
// Install callbacks on deferreds
|
||||||
|
for ( i in { success: 1, error: 1, complete: 1 } ) {
|
||||||
|
jqXHR[ i ]( s[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get transport
|
||||||
|
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
||||||
|
|
||||||
|
// If no transport, we auto-abort
|
||||||
|
if ( !transport ) {
|
||||||
|
done( -1, "No Transport" );
|
||||||
|
} else {
|
||||||
|
jqXHR.readyState = 1;
|
||||||
|
|
||||||
|
// Send global event
|
||||||
|
if ( fireGlobals ) {
|
||||||
|
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request was aborted inside ajaxSend, stop there
|
||||||
|
if ( state === 2 ) {
|
||||||
|
return jqXHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timeout
|
||||||
|
if ( s.async && s.timeout > 0 ) {
|
||||||
|
timeoutTimer = window.setTimeout( function() {
|
||||||
|
jqXHR.abort( "timeout" );
|
||||||
|
}, s.timeout );
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
state = 1;
|
||||||
|
transport.send( requestHeaders, done );
|
||||||
|
} catch ( e ) {
|
||||||
|
|
||||||
|
// Propagate exception as error if not done
|
||||||
|
if ( state < 2 ) {
|
||||||
|
done( -1, e );
|
||||||
|
|
||||||
|
// Simply rethrow otherwise
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for when everything is done
|
||||||
|
function done( status, nativeStatusText, responses, headers ) {
|
||||||
|
var isSuccess, success, error, response, modified,
|
||||||
|
statusText = nativeStatusText;
|
||||||
|
|
||||||
|
// Called once
|
||||||
|
if ( state === 2 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State is "done" now
|
||||||
|
state = 2;
|
||||||
|
|
||||||
|
// Clear timeout if it exists
|
||||||
|
if ( timeoutTimer ) {
|
||||||
|
window.clearTimeout( timeoutTimer );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dereference transport for early garbage collection
|
||||||
|
// (no matter how long the jqXHR object will be used)
|
||||||
|
transport = undefined;
|
||||||
|
|
||||||
|
// Cache response headers
|
||||||
|
responseHeadersString = headers || "";
|
||||||
|
|
||||||
|
// Set readyState
|
||||||
|
jqXHR.readyState = status > 0 ? 4 : 0;
|
||||||
|
|
||||||
|
// Determine if successful
|
||||||
|
isSuccess = status >= 200 && status < 300 || status === 304;
|
||||||
|
|
||||||
|
// Get response data
|
||||||
|
if ( responses ) {
|
||||||
|
response = ajaxHandleResponses( s, jqXHR, responses );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert no matter what (that way responseXXX fields are always set)
|
||||||
|
response = ajaxConvert( s, response, jqXHR, isSuccess );
|
||||||
|
|
||||||
|
// If successful, handle type chaining
|
||||||
|
if ( isSuccess ) {
|
||||||
|
|
||||||
|
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||||||
|
if ( s.ifModified ) {
|
||||||
|
modified = jqXHR.getResponseHeader( "Last-Modified" );
|
||||||
|
if ( modified ) {
|
||||||
|
jQuery.lastModified[ cacheURL ] = modified;
|
||||||
|
}
|
||||||
|
modified = jqXHR.getResponseHeader( "etag" );
|
||||||
|
if ( modified ) {
|
||||||
|
jQuery.etag[ cacheURL ] = modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no content
|
||||||
|
if ( status === 204 || s.type === "HEAD" ) {
|
||||||
|
statusText = "nocontent";
|
||||||
|
|
||||||
|
// if not modified
|
||||||
|
} else if ( status === 304 ) {
|
||||||
|
statusText = "notmodified";
|
||||||
|
|
||||||
|
// If we have data, let's convert it
|
||||||
|
} else {
|
||||||
|
statusText = response.state;
|
||||||
|
success = response.data;
|
||||||
|
error = response.error;
|
||||||
|
isSuccess = !error;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Extract error from statusText and normalize for non-aborts
|
||||||
|
error = statusText;
|
||||||
|
if ( status || !statusText ) {
|
||||||
|
statusText = "error";
|
||||||
|
if ( status < 0 ) {
|
||||||
|
status = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set data for the fake xhr object
|
||||||
|
jqXHR.status = status;
|
||||||
|
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
||||||
|
|
||||||
|
// Success/Error
|
||||||
|
if ( isSuccess ) {
|
||||||
|
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
||||||
|
} else {
|
||||||
|
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status-dependent callbacks
|
||||||
|
jqXHR.statusCode( statusCode );
|
||||||
|
statusCode = undefined;
|
||||||
|
|
||||||
|
if ( fireGlobals ) {
|
||||||
|
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
||||||
|
[ jqXHR, s, isSuccess ? success : error ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete
|
||||||
|
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
||||||
|
|
||||||
|
if ( fireGlobals ) {
|
||||||
|
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
||||||
|
|
||||||
|
// Handle the global AJAX counter
|
||||||
|
if ( !( --jQuery.active ) ) {
|
||||||
|
jQuery.event.trigger( "ajaxStop" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return jqXHR;
|
||||||
|
},
|
||||||
|
|
||||||
|
getJSON: function( url, data, callback ) {
|
||||||
|
return jQuery.get( url, data, callback, "json" );
|
||||||
|
},
|
||||||
|
|
||||||
|
getScript: function( url, callback ) {
|
||||||
|
return jQuery.get( url, undefined, callback, "script" );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
jQuery.each( [ "get", "post" ], function( i, method ) {
|
||||||
|
jQuery[ method ] = function( url, data, callback, type ) {
|
||||||
|
|
||||||
|
// Shift arguments if data argument was omitted
|
||||||
|
if ( jQuery.isFunction( data ) ) {
|
||||||
|
type = type || callback;
|
||||||
|
callback = data;
|
||||||
|
data = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The url can be an options object (which then must have .url)
|
||||||
|
return jQuery.ajax( jQuery.extend( {
|
||||||
|
url: url,
|
||||||
|
type: method,
|
||||||
|
dataType: type,
|
||||||
|
data: data,
|
||||||
|
success: callback
|
||||||
|
}, jQuery.isPlainObject( url ) && url ) );
|
||||||
|
};
|
||||||
|
} );
|
||||||
|
|
||||||
|
return jQuery;
|
||||||
|
} );
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user