Skip to content

Commit

Permalink
Enable electron support
Browse files Browse the repository at this point in the history
  • Loading branch information
leeight committed Jun 6, 2015
1 parent 2109766 commit 38e627d
Show file tree
Hide file tree
Showing 13 changed files with 5,878 additions and 3,538 deletions.
4 changes: 2 additions & 2 deletions src/bos_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ BosClient.prototype._prepareObjectHeaders = function (options) {
throw new TypeError('content_length should not be negative.');
}
else if (contentLength > MAX_PUT_OBJECT_LENGTH) { // 5G
throw new TypeError('Object length should be less than ' + MAX_PUT_OBJECT_LENGTH +
'. Use multi-part upload instead.');
throw new TypeError('Object length should be less than ' + MAX_PUT_OBJECT_LENGTH
+ '. Use multi-part upload instead.');
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ HttpClient.prototype.sendRequest = function (httpMethod, path, body, headers, pa
options.headers = headers;
if (typeof signFunction === 'function') {
var promise = signFunction(this.config.credentials, httpMethod, path, params, headers);
if (typeof promise === 'string') {
headers[H.AUTHORIZATION] = promise;
}
else if (isPromise(promise)) {
if (isPromise(promise)) {
return promise.then(function (authorization, xbceDate) {
headers[H.AUTHORIZATION] = authorization;
if (xbceDate) {
Expand All @@ -114,6 +111,9 @@ HttpClient.prototype.sendRequest = function (httpMethod, path, body, headers, pa
return client._doRequest(options, body, outputStream);
});
}
else if (util.isString(promise)) {
headers[H.AUTHORIZATION] = promise;
}
else {
throw new Error('Invalid signature = (' + promise + ')');
}
Expand Down
5 changes: 5 additions & 0 deletions src/media_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* @file src/media_client.js
* @author leeight
*/

/*eslint-env node*/
/*eslint max-params:[0,10]*/
/*eslint-disable fecs-camelcase*/

var util = require('util');

Expand Down Expand Up @@ -120,6 +124,7 @@ MediaClient.prototype.getJob = function (jobId, opt_options) {
* @param {boolean=} opt_transmux 是否仅执行容器格式转换.
* @param {string=} opt_description 转码模板描述.
* @param {Object=} opt_options Media Client 的配置.
* @return {Q.promise}
*/
MediaClient.prototype.createPreset = function (presetName, container, clip, audio, video,
opt_encryption, opt_transmux, opt_description, opt_options) {
Expand Down
6 changes: 1 addition & 5 deletions test/browser/demo/dep/async/0.0.0/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,12 +1105,8 @@
next();
};

// Node.js
if (typeof module !== 'undefined' && module.exports) {
module.exports = async;
}
// AMD / RequireJS
else if (typeof define !== 'undefined' && define.amd) {
if (typeof define !== 'undefined' && define.amd) {
define([], function () {
return async;
});
Expand Down
6 changes: 1 addition & 5 deletions test/browser/demo/dep/etpl/3.0.0/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1630,11 +1630,7 @@
var etpl = new Engine();
etpl.Engine = Engine;

if (typeof exports === 'object' && typeof module === 'object') {
// For CommonJS
exports = module.exports = etpl;
}
else if (typeof define === 'function' && define.amd) {
if (typeof define === 'function' && define.amd) {
// For AMD
define(etpl);
}
Expand Down
3 changes: 2 additions & 1 deletion test/browser/demo/dep/etpl/3.0.0/src/tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ define(

xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 300) {
// xhr.status === 0 说明请求是 file://
if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {
var source = xhr.responseText;
var moduleConfig = module.config();
if (moduleConfig.autoCompile
Expand Down
Loading

0 comments on commit 38e627d

Please sign in to comment.