ampersand-io-collection
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -6,6 +6,13 @@ /*$AMPERSAND_VERSION*/ | ||
var events = { | ||
fetch: 'collection-fetch', | ||
onFetch: 'collection-fetch-response', | ||
onUpdate: 'on-model-update', | ||
onNew: 'on-model-new' | ||
}; | ||
function AmpersandIOCollection(attrs, options){ | ||
options || (options = {}); | ||
Base.call(this, attrs, options); | ||
IOMixin.call(this, options.socket, options); | ||
AmpersandIO.call(this, options.socket, options); | ||
} | ||
@@ -15,8 +22,3 @@ | ||
events: { | ||
fetch: 'collection-fetch', | ||
onFetch: 'on-collection-fetch', | ||
onUpdate: 'on-model-update', | ||
onNew: 'on-model-new' | ||
}, | ||
events: events, | ||
@@ -56,3 +58,3 @@ listeners: { | ||
if (err){ | ||
this.trigger('error', this, response, options); | ||
collection.trigger('error', this, response, options); | ||
} | ||
@@ -177,5 +179,5 @@ }; | ||
AmpersandIOCollection.prototype = Object.create(Base.prototype); | ||
extend(AmpersandIOCollection.prototype, Object.create(IOMixin.prototype)); | ||
extend(AmpersandIOCollection.prototype, IOMixin.prototype); | ||
AmpersandIOCollection.extend = Base.extend; | ||
module.exports = AmpersandIOCollection; |
@@ -32,3 +32,3 @@ var io = require('socket.io')(); | ||
console.log(data); | ||
socket.emit('fetch-response', {test: 'test'}, function(){console.log('done');}); | ||
socket.emit('collection-fetch-response', {test: 'test'}, function(){console.log('done');}); | ||
cb(); | ||
@@ -45,3 +45,4 @@ }); | ||
}}); | ||
var mycollection = new ((AmpersandCollection.extend(new IOCollection())).extend({model: mymodel}))(); | ||
var mycollection = new (IOCollection.extend({model: mymodel}))({}, {socket: 'http://localhost:3000'}); | ||
console.log(mycollection); | ||
@@ -48,0 +49,0 @@ mycollection.setListeners(); |
{ | ||
"name": "ampersand-io-collection", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "ampersand collection mixin based on rest collection mixin to be used with socket.io", | ||
"main": "ampersand-io-collection.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "browserify tests | tape-run | tap-spec", | ||
"lint": "node_modules/.bin/jshint -c .jshintrc ampersand-io-collection.js" | ||
@@ -15,3 +15,3 @@ }, | ||
"type": "git", | ||
"url": "https://github.com/JGAntunes/ampersand-io-collection" | ||
"url": "https://github.com/sinfo/ampersand-io-collection" | ||
}, | ||
@@ -27,21 +27,20 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/JGAntunes/ampersand-io-collection/issues" | ||
"url": "https://github.com/sinfo/ampersand-io-collection/issues" | ||
}, | ||
"homepage": "https://github.com/JGAntunes/ampersand-io-collection", | ||
"homepage": "https://github.com/sinfo/ampersand-io-collection", | ||
"dependencies": { | ||
"extend-object": "^1.0.0", | ||
"ampersand-collection": "~1.3.17", | ||
"ampersand-io": "^0.1.0" | ||
"ampersand-collection": "^1.3.17", | ||
"ampersand-io": "^0.4.2" | ||
}, | ||
"devDependencies": { | ||
"ampersand-collection": "^1.3.17", | ||
"ampersand-io-model": "https://github.com/jgantunes/ampersand-io-model/tarball/master", | ||
"browserify": "^7.0.1", | ||
"jshint": "~2.5.10", | ||
"pre-commit": "https://github.com/jgantunes/pre-commit/tarball/master", | ||
"ampersand-io-model": "^0.3.0", | ||
"browserify": "^9.0.3", | ||
"jshint": "^2.6.3", | ||
"pre-commit": "^1.0.6", | ||
"socket.io": "^1.2.1", | ||
"tap-spec": "^2.1.2", | ||
"tape": "^3.0.3", | ||
"tape-run": "^0.3.0" | ||
"tape-run": "^1.0.0" | ||
} | ||
} |
@@ -0,2 +1,23 @@ | ||
[![Build Status](https://travis-ci.org/sinfo/ampersand-io-collection.svg?branch=master)](https://travis-ci.org/sinfo/ampersand-io-collection) | ||
[![Dependency Status](https://david-dm.org/sinfo/ampersand-io-collection.svg)](https://david-dm.org/sinfo/ampersand-io-collection) | ||
[![devDependency Status](https://david-dm.org/sinfo/ampersand-io-collection/dev-status.svg)](https://david-dm.org/sinfo/ampersand-io-collection#info=devDependencies) | ||
ampersand-io-collection | ||
============================= | ||
Still under development. Further documentation on the way. | ||
Based on [ampersand-collection-rest-mixin](https://github.com/AmpersandJS/ampersand-collection-rest-mixin) to be used with [socket.io](http://socket.io). | ||
ampersand-io-collection is not a mixin but an extension built on [ampersand-collection](http://ampersandjs.com/docs/#ampersand-collection) to provide methods and properties that you'll often want when modeling data and collections you get from an API, using a realtime based socket app. | ||
See also the [ampersand-io](https://github.com/sinfo/ampersand-io) documentation for further info on the `socket.io` ampersand wrapper API this module uses. | ||
## Installing | ||
npm install ampersand-io-collection | ||
``` | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
19753
8
9
528
1
1
23
1
+ Addedampersand-collection@1.6.1(transitive)
+ Addedampersand-events@1.1.1(transitive)
+ Addedampersand-io@0.4.2(transitive)
+ Addedampersand-version@1.0.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedfind-root@0.1.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlodash._arrayeach@3.0.0(transitive)
+ Addedlodash._baseeach@3.0.4(transitive)
+ Addedlodash._createwrapper@3.2.0(transitive)
+ Addedlodash._replaceholders@3.0.0(transitive)
+ Addedlodash._root@3.0.1(transitive)
+ Addedlodash.before@3.0.3(transitive)
+ Addedlodash.bind@3.1.0(transitive)
+ Addedlodash.foreach@3.0.3(transitive)
+ Addedlodash.isempty@3.0.4(transitive)
+ Addedlodash.isfunction@3.0.9(transitive)
+ Addedlodash.isstring@3.0.1(transitive)
+ Addedlodash.once@3.0.1(transitive)
+ Addedlodash.uniqueid@3.2.0(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedthrough2@0.6.5(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedampersand-collection@1.3.17(transitive)
- Removedampersand-io@0.1.0(transitive)
- Removedbackbone-events-standalone@0.2.2(transitive)
- Removedis-array@1.0.1(transitive)
Updatedampersand-collection@^1.3.17
Updatedampersand-io@^0.4.2