mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(directory) add ability to upload directories via drag n drop in Chrome
This commit is contained in:
parent
2790799b98
commit
44531adfc6
27 changed files with 1137 additions and 4 deletions
35
modules/emitify/.bower.json
Normal file
35
modules/emitify/.bower.json
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "emitify",
|
||||
"version": "1.2.0",
|
||||
"homepage": "https://github.com/coderaiser/emitify",
|
||||
"authors": [
|
||||
"coderaiser <mnemonic.enemy@gmail.com>"
|
||||
],
|
||||
"description": "Dead simple event emitter",
|
||||
"main": "lib/emitify.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"_release": "1.2.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.2.0",
|
||||
"commit": "5dd1685840ba4905c7fcbd7b00202bed4baeb1ad"
|
||||
},
|
||||
"_source": "git://github.com/coderaiser/emitify.git",
|
||||
"_target": "~1.2.0",
|
||||
"_originalSource": "emitify"
|
||||
}
|
||||
47
modules/emitify/ChangeLog
Normal file
47
modules/emitify/ChangeLog
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
2015.06.16, v1.2.0
|
||||
|
||||
feature:
|
||||
- (emitify) add instanceof check
|
||||
|
||||
|
||||
2015.02.24, v1.1.2
|
||||
|
||||
fix:
|
||||
- (emitify) once: do not remove callback after emit
|
||||
|
||||
|
||||
2015.02.11, v1.1.1
|
||||
|
||||
fix:
|
||||
- (emitify) emit throw: data -> args[0]
|
||||
|
||||
feature:
|
||||
- (package) v1.1.0
|
||||
|
||||
|
||||
2015.02.11, v1.1.0
|
||||
|
||||
feature:
|
||||
- (emitify) emit: add ability to use more then two arguments
|
||||
|
||||
|
||||
2015.02.10, v1.0.3
|
||||
|
||||
fix:
|
||||
- (emitify) "event should be function"
|
||||
|
||||
|
||||
2015.02.10, v1.0.2
|
||||
|
||||
feature:
|
||||
- (emitify) add arguments check
|
||||
|
||||
|
||||
2015.02.10, v1.0.1
|
||||
|
||||
fix:
|
||||
- (emitify) off: index do not changed
|
||||
|
||||
feature:
|
||||
- (bower) add
|
||||
|
||||
21
modules/emitify/LICENSE
Normal file
21
modules/emitify/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 coderaiser
|
||||
|
||||
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.
|
||||
63
modules/emitify/README.md
Normal file
63
modules/emitify/README.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# Emitify
|
||||
|
||||
Dead simple event emitter.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm i emitify --save
|
||||
bower i emitify --save
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
What you should do first is create new instance of `emitify` with
|
||||
|
||||
```js
|
||||
var emitify = Emitify();
|
||||
```
|
||||
|
||||
Than you could just use API as it is.
|
||||
|
||||
### emitter.on(event, callback)
|
||||
|
||||
Add `callback` listener to `event`.
|
||||
|
||||
### emitter.off(event, callback)
|
||||
|
||||
Remove `callback` listener from `event`.
|
||||
|
||||
### emitter.emit(event [, data1, data2, ..., dataN])
|
||||
|
||||
Emit `event` with (or without) data.
|
||||
|
||||
### emitter.addListener(event, callback)
|
||||
|
||||
Alias to `emitter.on`.
|
||||
|
||||
### emitter.removeListener(event, callback)
|
||||
|
||||
Alias to `emitter.off`.
|
||||
|
||||
## How to use?
|
||||
|
||||
```js
|
||||
var Emitify = require('emitify'),
|
||||
emitter = new Emitify(),
|
||||
log = function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
emitter.on('data', log);
|
||||
|
||||
emitter.emit('data', 'hello');
|
||||
// result
|
||||
'hello'
|
||||
|
||||
emitter.off('data', log);
|
||||
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
26
modules/emitify/bower.json
Normal file
26
modules/emitify/bower.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "emitify",
|
||||
"version": "1.2.0",
|
||||
"homepage": "https://github.com/coderaiser/emitify",
|
||||
"authors": [
|
||||
"coderaiser <mnemonic.enemy@gmail.com>"
|
||||
],
|
||||
"description": "Dead simple event emitter",
|
||||
"main": "lib/emitify.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
82
modules/emitify/lib/emitify.js
Normal file
82
modules/emitify/lib/emitify.js
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
(function(global) {
|
||||
'use strict';
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports)
|
||||
module.exports = Emitify;
|
||||
else
|
||||
global.Emitify = Emitify;
|
||||
|
||||
function Emitify() {
|
||||
if (this instanceof Emitify)
|
||||
this._all = {};
|
||||
else
|
||||
return new Emitify();
|
||||
}
|
||||
|
||||
Emitify.prototype._check = function(event, callback) {
|
||||
var isTwo = arguments.length === 2;
|
||||
|
||||
if (typeof event !== 'string')
|
||||
throw(Error('event should be string!'));
|
||||
|
||||
if (isTwo && typeof callback !== 'function')
|
||||
throw(Error('callback should be function!'));
|
||||
};
|
||||
|
||||
Emitify.prototype.on = function(event, callback) {
|
||||
var funcs = this._all[event];
|
||||
|
||||
this._check(event, callback);
|
||||
|
||||
if (funcs)
|
||||
funcs.push(callback);
|
||||
else
|
||||
this._all[event] = [callback];
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Emitify.prototype.addListener =
|
||||
Emitify.prototype.on;
|
||||
|
||||
Emitify.prototype.once = function(event, callback) {
|
||||
var self = this;
|
||||
|
||||
self._check(event, callback);
|
||||
|
||||
self.on(event, function fn() {
|
||||
callback();
|
||||
self.off(event, fn);
|
||||
});
|
||||
};
|
||||
|
||||
Emitify.prototype.off = function(event, callback) {
|
||||
var events = this._all[event] || [],
|
||||
index = events.indexOf(callback);
|
||||
|
||||
this._check(event, callback);
|
||||
|
||||
while (~index) {
|
||||
events.splice(index, 1);
|
||||
index = events.indexOf(callback);
|
||||
}
|
||||
};
|
||||
|
||||
Emitify.prototype.removeListener =
|
||||
Emitify.prototype.off;
|
||||
|
||||
Emitify.prototype.emit = function(event) {
|
||||
var args = [].slice.call(arguments, 1),
|
||||
funcs = this._all[event];
|
||||
|
||||
this._check(event);
|
||||
|
||||
if (funcs)
|
||||
funcs.forEach(function(fn) {
|
||||
fn.apply(null, args);
|
||||
});
|
||||
else if (event === 'error')
|
||||
throw args[0];
|
||||
};
|
||||
|
||||
})(this);
|
||||
23
modules/emitify/package.json
Normal file
23
modules/emitify/package.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "emitify",
|
||||
"version": "1.2.0",
|
||||
"description": "dead simple event emitter",
|
||||
"main": "lib/emitify.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/coderaiser/emitify.git"
|
||||
},
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter"
|
||||
],
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (http://coderaiser.github.io/)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/coderaiser/emitify/issues"
|
||||
},
|
||||
"homepage": "https://github.com/coderaiser/emitify"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue