Skip to content

Commit 8fd3762

Browse files
committed
register profiles
1 parent f5e6cf0 commit 8fd3762

6 files changed

+66
-10
lines changed

dist/qiniu-uploader.js

+32-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/profile.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Profile {
2+
constructor(uploader, options={}) {
3+
this.uploader = uploader;
4+
5+
this.name = options.name;
6+
this.bucket = options.bucket;
7+
this.domain = options.domain;
8+
this.ssl = options.ssl || false;
9+
this.uptokenUrl = options.uptokenUrl;
10+
11+
this.public = true;
12+
if (options.has('public'))
13+
this.public = options.public;
14+
}
15+
}

src/qiniu-uploader.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
import Profile from './profile';
2+
13
class QiniuUploader {
2-
constructor() {
3-
console.log('hello there.');
4+
constructor(options={}) {
5+
uptokenUrl = options.uptokenUrl;
6+
7+
// Register profiles if any.
8+
if (Array.isArray(options.profiles)) {
9+
options.profiles.forEach(profile => {
10+
register(profile);
11+
});
12+
}
413
}
5-
}
14+
15+
register(profile) {
16+
profiles[profile.name] = new Profile(uploader, profile);
17+
}
18+
}

0 commit comments

Comments
 (0)