Skip to content

Commit 9def932

Browse files
ilessiiviilessiivi
andauthored
Unify code styling (#356)
* Ignore package-lock.json * Add a simple editorconfig * Unified formatting and tabs to spaces * Convert line endings to lf * Formatting on test specs * Clean up rollup config Co-authored-by: ilessiivi <iless@me.com>
1 parent 3c04f87 commit 9def932

16 files changed

+684
-683
lines changed

.babelrc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"inputSourceMap": true,
3-
"presets": [
4-
[
5-
"@babel/preset-env",
6-
{
7-
"useBuiltIns": "usage",
8-
"corejs": 3,
9-
}
10-
]
2+
"inputSourceMap": true,
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"useBuiltIns": "usage",
8+
"corejs": 3,
9+
}
1110
]
11+
]
1212
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*~
22

33
# Node
4+
package-lock.json
45
/build
56
/node_modules
67
/bower_components

CHANGELOG.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
# 3.0.0
2-
3-
## Breaking Changes
4-
5-
### Events
6-
- Events are distincts from hooks.
7-
- Recognized events and hooks are now lower-snake-case (case-sensitive).
8-
- Hooks are "file-added", "files-added", "files-submitted". "filter-file" is a filtering hook.
9-
- Events are passed a native CustomEvent. IE:
10-
v2: `flow.on('fileRemoved', (file) => { ... });`
11-
v3: `flow.on('file-removed', ({detail: [file]}) => { ... });`
12-
13-
### Other
14-
- FlowFile does not run bootstrap() upon instanciation. This must be done manually (or rely on *addFile* functions).
15-
16-
# 2.0.0
17-
18-
## Features
19-
20-
- All code follows Google javascript style guide
21-
- Target url can be provided with query string
22-
- Events **fileAdded** and **filesAdded** can prevent file from being added to $.files list by
23-
returning false. Custom validators can be ran here.
24-
- **ResumableFile.getType()** and **ResumableFile.getExtension()** helper methods added. Can be
25-
used for custom validation.
26-
- **fileProgress** and **progress** events are always asynchronous.
27-
- **ResumableFile.pause()** and **ResumableFile.resume()** methods for single file pausing and
28-
resuming.
29-
- **filesSubmitted** event added. Can be used to start file upload. Event is thrown then files are
30-
added to queue.
31-
- **progressCallbacksInterval** parameter added. Minimum interval between callbacks execution in
32-
milliseconds.
33-
- **averageSpeed** and **currentSpeed** parameters added for `ResumableFile`. These params
34-
accuracy can be adjusted with `speedSmoothingFactor` and `progressCallbacksInterval` parameters.
35-
- **timeRemaining** method added for `ResumableFile`. Returns remaining time to upload in seconds. Accuracy is based on average speed.
36-
- **sizeUploaded** method added for `ResumableFile`. Returns size uploaded in bytes.
37-
- **singleFile** parameter added. Then enabled, uploaded file will replace current one.
38-
39-
## Breaking Changes
40-
- **Resumable** was renamed to **Flow**
41-
- **ResumableFile.fileName** parameter renamed to **ResumableFile.name**
42-
- **Resumable.getOpt** method dropped, use Resumable.opts parameter instead if needed.
43-
- **Resumable.maxFiles**, **Resumable.minFileSize**, **Resumable.maxFileSize**,
44-
**Resumable.fileType** validators dropped. Use **fileAdded** and **filesAdded** events for
45-
custom validation.
46-
- **fileProgress** and **progress** events are not thrown on ResumableFile.abort() and ResumableFile.cancel() methods execution.
47-
- **cancel** event was removed. Event was always called after **Resumable.cancel()** function.
48-
- **fileAdded**, **filesAdded** events are thrown before file is added to upload queue. This means
49-
that calling **Resumable.upload()** method in these events will not start uploading current
50-
files. To start upload use **filesSubmitted** event instead.
51-
- **throttleProgressCallbacks** parameter was replaced with **progressCallbacksInterval** and it
52-
is now measured in milliseconds.
1+
# 3.0.0
2+
3+
## Breaking Changes
4+
5+
### Events
6+
- Events are distincts from hooks.
7+
- Recognized events and hooks are now lower-snake-case (case-sensitive).
8+
- Hooks are "file-added", "files-added", "files-submitted". "filter-file" is a filtering hook.
9+
- Events are passed a native CustomEvent. IE:
10+
v2: `flow.on('fileRemoved', (file) => { ... });`
11+
v3: `flow.on('file-removed', ({detail: [file]}) => { ... });`
12+
13+
### Other
14+
- FlowFile does not run bootstrap() upon instanciation. This must be done manually (or rely on *addFile* functions).
15+
16+
# 2.0.0
17+
18+
## Features
19+
20+
- All code follows Google javascript style guide
21+
- Target url can be provided with query string
22+
- Events **fileAdded** and **filesAdded** can prevent file from being added to $.files list by
23+
returning false. Custom validators can be ran here.
24+
- **ResumableFile.getType()** and **ResumableFile.getExtension()** helper methods added. Can be
25+
used for custom validation.
26+
- **fileProgress** and **progress** events are always asynchronous.
27+
- **ResumableFile.pause()** and **ResumableFile.resume()** methods for single file pausing and
28+
resuming.
29+
- **filesSubmitted** event added. Can be used to start file upload. Event is thrown then files are
30+
added to queue.
31+
- **progressCallbacksInterval** parameter added. Minimum interval between callbacks execution in
32+
milliseconds.
33+
- **averageSpeed** and **currentSpeed** parameters added for `ResumableFile`. These params
34+
accuracy can be adjusted with `speedSmoothingFactor` and `progressCallbacksInterval` parameters.
35+
- **timeRemaining** method added for `ResumableFile`. Returns remaining time to upload in seconds. Accuracy is based on average speed.
36+
- **sizeUploaded** method added for `ResumableFile`. Returns size uploaded in bytes.
37+
- **singleFile** parameter added. Then enabled, uploaded file will replace current one.
38+
39+
## Breaking Changes
40+
- **Resumable** was renamed to **Flow**
41+
- **ResumableFile.fileName** parameter renamed to **ResumableFile.name**
42+
- **Resumable.getOpt** method dropped, use Resumable.opts parameter instead if needed.
43+
- **Resumable.maxFiles**, **Resumable.minFileSize**, **Resumable.maxFileSize**,
44+
**Resumable.fileType** validators dropped. Use **fileAdded** and **filesAdded** events for
45+
custom validation.
46+
- **fileProgress** and **progress** events are not thrown on ResumableFile.abort() and ResumableFile.cancel() methods execution.
47+
- **cancel** event was removed. Event was always called after **Resumable.cancel()** function.
48+
- **fileAdded**, **filesAdded** events are thrown before file is added to upload queue. This means
49+
that calling **Resumable.upload()** method in these events will not start uploading current
50+
files. To start upload use **filesSubmitted** event instead.
51+
- **throttleProgressCallbacks** parameter was replaced with **progressCallbacksInterval** and it
52+
is now measured in milliseconds.

babel.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"@babel/preset-env",
55
{
66
"useBuiltIns": "entry",
7-
"corejs": "3.8"
7+
"corejs": "3.8"
88
}
99
]
1010
]

package.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ Package.describe({
1818
Package.onUse(function(api) {
1919
api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']); // Meteor versions
2020

21-
2221
api.addFiles('./dist/flow.js', where); // Files in use
23-
24-
});
22+
});

rollup.config.js

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,45 @@ import resolve from '@rollup/plugin-node-resolve';
77
import strip from '@rollup/plugin-strip';
88
import { terser } from "rollup-plugin-terser";
99

10-
let plugins = [
11-
resolve(),
12-
commonjs(),
13-
replace({
14-
"<%= version %>": `'${pkg.version}'`,
15-
delimiters: ["'", "'"]
16-
}),
17-
18-
babel({ babelHelpers: 'bundled' })
10+
const plugins = [
11+
resolve(),
12+
commonjs(),
13+
replace({
14+
"<%= version %>": `'${pkg.version}'`,
15+
delimiters: ["'", "'"]
16+
}),
17+
babel({
18+
babelHelpers: 'bundled'
19+
})
1920
];
2021

21-
export default [
22-
{
23-
input: 'src/Flow.js',
24-
plugins,
25-
output: {
26-
name: 'Flow',
27-
file: pkg.browser,
28-
sourcemap: true,
29-
format: 'umd',
30-
},
31-
},
32-
{
33-
input: 'src/Flow.js',
34-
plugins: plugins.concat([strip({functions:['console.(log|debug)','debug','alert']}), terser()]),
35-
output: {
36-
name: 'Flow',
37-
banner: `/*! ${pkg.name} ${pkg.version} */\n`,
38-
file: pkg.browser.replace(/js$/, 'min.js'),
39-
sourcemap: true,
40-
format: 'esm',
41-
},
42-
},
43-
{
44-
input: 'src/Flow.js',
45-
plugins: plugins.concat([istanbul({exclude: ['node_modules/**/*.js']})]),
46-
output: {
47-
name: 'Flow',
48-
banner: `/*! ${pkg.name} ${pkg.version} */\n`,
49-
file: pkg.browser.replace(/js$/, 'cov.js'),
50-
sourcemap: true,
51-
format: 'umd',
52-
},
53-
}
54-
55-
];
22+
export default [{
23+
input: 'src/Flow.js',
24+
plugins,
25+
output: {
26+
name: 'Flow',
27+
file: pkg.browser,
28+
sourcemap: true,
29+
format: 'umd'
30+
}
31+
}, {
32+
input: 'src/Flow.js',
33+
plugins: plugins.concat(strip({ functions: ['console.(log|debug)', 'debug', 'alert'] }), terser()),
34+
output: {
35+
name: 'Flow',
36+
banner: `/*! ${pkg.name} ${pkg.version} */\n`,
37+
file: pkg.browser.replace(/js$/, 'min.js'),
38+
sourcemap: true,
39+
format: 'esm'
40+
}
41+
}, {
42+
input: 'src/Flow.js',
43+
plugins: plugins.concat(istanbul({ exclude: ['node_modules/**/*.js'] })),
44+
output: {
45+
name: 'Flow',
46+
banner: `/*! ${pkg.name} ${pkg.version} */\n`,
47+
file: pkg.browser.replace(/js$/, 'cov.js'),
48+
sourcemap: true,
49+
format: 'umd'
50+
}
51+
}];

src/Eventizer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ export default class extends EventTarget {
219219
for (const [i, v] of this._events[event].entries()) {
220220
if ((!callback || v.listener == callback) && v.useCapture == options) {
221221
// console.log(`[event] Removed one callback from "${event}"`);
222-
this._events[event].splice(i, 1);
222+
this._events[event].splice(i, 1);
223223
if (! callback) {
224224
this._removeEventListener(event, v.listener, v);
225225
} else {
226-
break;
226+
break;
227227
}
228228
}
229229
}

src/FlowChunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export default class FlowChunk {
466466
} else {
467467
if (this.flowObj.opts.successStatuses.indexOf(this.xhr.status) > -1) {
468468
// HTTP 200, perfect
469-
// HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed.
469+
// HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed.
470470
return 'success';
471471
} else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 ||
472472
!isTest && this.retries >= this.flowObj.opts.maxChunkRetries) {

0 commit comments

Comments
 (0)