Socket
Socket
Sign inDemoInstall

angular-evaporate

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

example/.jshintrc

170

lib/angular-evaporate.js

@@ -221,80 +221,130 @@ /* global angular, Evaporate */

/**
* Create an upload from file and append it to the queue.
* @params - same as for Evaporate.add()
* @returns {AngularEvaporateUpload}
*/
AngularEvaporate.prototype.$enqueue = function () {
// individual upload
// create an upload
var upload = new AngularEvaporateUpload(this, arguments[0]);
/**
* Create an upload from file and append it to the queue.
* @params - same as for Evaporate.add()
* @returns {AngularEvaporateUpload}
*/
AngularEvaporate.prototype.$enqueue = function () {
//
upload.$start = this.$start.bind.apply(this.$start, [this, upload].concat(Array.prototype.slice.call(arguments, 1)));
upload.$dequeue = this.$dequeue.bind(this, upload);
// create an upload
var upload = new AngularEvaporateUpload(this, arguments[0]);
// append to the list
this.$uploads.push(upload);
//
upload.$start = this.$start.bind.apply(this.$start, [this, upload].concat(Array.prototype.slice.call(arguments, 1)));
upload.$dequeue = this.$dequeue.bind(this, upload);
// update scope
if (this.$apply) $timeout(this.$apply);
// append to the list
this.$uploads.push(upload);
//
return upload;
};
// update scope
if (this.$apply) $timeout(this.$apply);
/**
* Remove an upload from the queue.
* @param {AngularEvaporateUpload}
* @returns {Number} index
*/
AngularEvaporate.prototype.$dequeue = function (upload) {
//
return upload;
};
// find it in the list
var index = this.$uploads.findIndex(function (upload) { return (upload === this); }, upload);
if (index !== -1) {
/**
* Remove an upload from the queue.
* @param {AngularEvaporateUpload}
* @returns {Number} index
*/
AngularEvaporate.prototype.$dequeue = function (upload) {
// and remove
this.$uploads.splice(index, 1);
// find it in the list
var index = this.$uploads.findIndex(function (upload) { return (upload === this); }, upload);
if (index !== -1) {
// and remove
this.$uploads.splice(index, 1);
// update scope
if (this.$apply) $timeout(this.$apply);
}
//
return index;
};
/**
* Start uploading an already queued upload.
* @param {AngularEvaporateUpload}
* @returns - same as Evaporate.add()
*/
AngularEvaporate.prototype.$start = function (upload) {
// run
upload.$id = this.add.apply(this, arguments);
// modify api
delete upload.$start;
upload.$pause = this.pause.bind(this, upload.$id);
upload.$resume = this.resume.bind(this, upload.$id);
upload.$cancel = this.cancel.bind(this, upload.$id);
// update scope
if (this.$apply) $timeout(this.$apply);
}
//
return index;
};
//
return upload.$id;
};
/**
* Enqueue and immediately start uploading.
* @params - same as for Evaporate.add()
* @returns - same as Evaporate.add()
*/
AngularEvaporate.prototype.$add = function () {
var upload = this.$enqueue.apply(this, arguments);
return upload.$start();
};
/**
* Enqueue and immediately start uploading.
* @params - same as for Evaporate.add()
* @returns - same as Evaporate.add()
*/
AngularEvaporate.prototype.$add = function () {
var upload = this.$enqueue.apply(this, arguments);
return upload.$start();
};
/**
* Start uploading an already queued upload.
* @param {AngularEvaporateUpload}
* @returns - same as Evaporate.add()
*/
AngularEvaporate.prototype.$start = function (upload) {
// all uploads
// run
upload.$id = this.add.apply(this, arguments);
/**
* Start all uploads.
*/
AngularEvaporate.prototype.$startAll = function () {
this.$uploads.forEach(function (upload) {
if (upload.$start) upload.$start();
});
};
/**
* Pause all uploads.
* @params - same as for Evaporate.pause(), but without an id
*/
AngularEvaporate.prototype.$pauseAll = function () {
return this.pause.apply(this, [undefined].concat(Array.prototype.slice.call(arguments)));
};
/**
* Resume all uploads.
* @params - same as for Evaporate.resume(), but without an id
*/
AngularEvaporate.prototype.$resumeAll = function () {
return this.resume.apply(this, [undefined].concat(Array.prototype.slice.call(arguments)));
};
/**
* Cancel all uploads.
*/
AngularEvaporate.prototype.$cancelAll = function () {
this.$uploads.forEach(function (upload) {
if (upload.$cancel) upload.$cancel();
});
};
// modify api
upload.$pause = this.pause.bind(this, upload.$id);
upload.$resume = this.resume.bind(this, upload.$id);
upload.$cancel = this.cancel.bind(this, upload.$id);
upload.$start = upload.$resume;
/**
* Dequeue all uploads.
*/
AngularEvaporate.prototype.$dequeueAll = function () {
// update scope
if (this.$apply) $timeout(this.$apply);
// flush the queue
this.$uploads = [];
//
return upload.$id;
};
// update scope
if (this.$apply) $timeout(this.$apply);
};

@@ -301,0 +351,0 @@ return AngularEvaporate;

{
"author": {
"name": "Denis Zhbankov",
"url": "https://github.com/uqee"
},
"contributors": [
{
"name": "Marvin Killing",
"url": "https://github.com/mkilling"
},
{
"name": "Eugene Khashin",
"url": "https://github.com/adastreamer"
}
],
"dependencies": {
"angular": "^1.5.8",
"evaporate": "^1.5.2"
},
"version": "2.0.0-beta.3",
"name": "angular-evaporate",
"description": "AngularJS module for the EvaporateJS library",
"devDependencies": {
"bootstrap": "^3.3.7",
"express": "^4.14.0",
"font-awesome": "^4.6.3",
"morgan": "^1.7.0",
"serve-static": "^1.11.1",
"uglify-js": "^2.7.3"
},
"engines": {
"node": "4.x"
},
"homepage": "http://github.com/uqee/angular-evaporate",

@@ -41,3 +14,2 @@ "keywords": [

"main": "lib/angular-evaporate.js",
"name": "angular-evaporate",
"repository": {

@@ -47,7 +19,47 @@ "type": "git",

},
"engines": {
"node": "4.x"
},
"dependencies": {
"angular": "^1.5.8",
"evaporate": "^1.5.2"
},
"devDependencies": {
"angular-mocks": "^1.5.8",
"bootstrap": "^3.3.7",
"chai": "^3.5.0",
"diff": "^3.0.0",
"express": "^4.14.0",
"font-awesome": "^4.6.3",
"karma": "^1.2.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.1.0",
"karma-sinon": "^1.0.5",
"mocha": "^3.0.2",
"morgan": "^1.7.0",
"serve-static": "^1.11.1",
"sinon": "^1.17.5",
"uglify-js": "^2.7.3"
},
"scripts": {
"start": "node ./example/server.js",
"test": "karma start ./test/karma.conf.js",
"uglify": "cd lib && uglifyjs --compress --mangle --screw-ie8 -o angular-evaporate.min.js --source-map angular-evaporate.min.js.map -- angular-evaporate.js"
},
"version": "2.0.0-beta.2"
"author": {
"name": "Denis Zhbankov",
"url": "https://github.com/uqee"
},
"contributors": [
{
"name": "Marvin Killing",
"url": "https://github.com/mkilling"
},
{
"name": "Eugene Khashin",
"url": "https://github.com/adastreamer"
}
]
}

@@ -79,2 +79,9 @@ > Current release is in beta stage, it will be released as v2.0.0 when tests added. If you're using a 1.x version, please read the corresponding readme from your distribution.

## Test
```bash
npm install && npm test
```
## Example

@@ -126,8 +133,13 @@

| --- | --- | --- | ---
| `$add` | same as for `Evaporate.add()` | `AngularEvaporateUpload` | enqueue and start uploading immediately
| `$enqueue` | same as for `Evaporate.add()` | `AngularEvaporateUpload` | create an upload and append it to the queue
| `$dequeue` | `AngularEvaporateUpload` | `Number` - index in `$uploads` | remove an upload from the queue
| `$start` | `AngularEvaporateUpload` | same as from `Evaporate.add()` | start uploading an already queued upload
| `$add` | same as for `Evaporate.add()` | same as from `Evaporate.add()` | enqueue and start uploading immediately
| Function | Arguments | Result
| --- | --- | ---
| `$startAll`,<br/>`$cancelAll`,<br/>`$dequeueAll` | - | -
| `$pauseAll`,<br/>`$resumeAll` | same as for `Evaporate[fn](undefined, ...)`, where `fn` is `pause` or `resume` | same as from `Evaporate[fn](undefined, ...)`
---

@@ -146,5 +158,5 @@

| `$url` | `String` | read only | full url of the file when it's uploaded
| `$started`, `$paused`,<br/>`$resumed`, `$pausing`,<br/>`$cancelled`, `$complete`,<br/>`$info`, `$warn`,<br/>`$error`, `$progress` | `Number` | optional | `Date.now()` of every `Evaporate`'s callback fired
| `$started`,<br/>`$paused`,<br/>`$resumed`,<br/>`$pausing`,<br/>`$cancelled`,<br/>`$complete`,<br/>`$info`,<br/>`$warn`,<br/>`$error`,<br/>`$progress` | `Number` | optional | `Date.now()` of every `Evaporate`'s callback fired
| `$stopped` | `Number` | optional | value of either `$complete`, `$cancelled` or `$error`
| `$infoMsg`, `$warnMsg`, `$errorMsg` | `String` | optional | input parameter of the corresponding callback
| `$infoMsg`,<br/>`$warnMsg`,<br/>`$errorMsg` | `String` | optional | input parameter of the corresponding callback
| `$percent` | `Number` | optional | current uploading progress

@@ -155,5 +167,5 @@ | `$seconds` | `Number` | optional | estimated elapsed time

| Function | Arguments | Result | Description
| --- | --- | --- | ---
| `$start` | - | same as from `Evaporate.add()` | start or resume this upload if already started
| `$pause`, `$resume`, `$cancel` | - | same as from the corresponding `Evaporate[fn](id)` | alter this upload correspondingly
| Function | Arguments | Result
| --- | --- | ---
| `$start` | - | same as from `Evaporate.add()`
| `$pause`,<br/>`$resume`,<br/>`$cancel` | same as for the corresponding `Evaporate[fn](id, ...)` | same as from the corresponding `Evaporate[fn](id, ...)`

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc