Commit 00ad6db5 authored by Tristan Cavelier's avatar Tristan Cavelier

s3storage.js amd compatible now

parent 3865c36d
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*global jIO: true, btoa: true, b64_hmac_sha1: true */
/*global XMLHttpRequest: true, XHRwrapper: true, FormData: true, $: true*/
/*global define, jIO, btoa, b64_hmac_sha1, jQuery, XMLHttpRequest, XHRwrapper,
FormData*/
/**
* JIO S3 Storage. Type = "s3".
* Amazon S3 "database" storage.
*/
jIO.addStorageType("s3", function (spec, my) {
// define([module_name], [dependencies], module);
(function (dependencies, module) {
"use strict";
if (typeof define === 'function' && define.amd) {
return define(dependencies, module);
}
module(jIO, jQuery, {b64_hmac_sha1: b64_hmac_sha1});
}(['jio', 'jquery', 'sha1'], function (jIO, $, sha1) {
var b64_hmac_sha1 = sha1.b64_hmac_sha1;
jIO.addStorageType("s3", function (spec, my) {
var evt, that, priv = {};
spec = spec || {};
that = my.basicStorage(spec, my);
......@@ -288,7 +298,8 @@ jIO.addStorageType("s3", function (spec, my) {
obj.onreadystatechange = function () {
var response, err = '';
if (obj.readyState === 4) {
if (this.status === 204 || this.status === 201 || this.status === 200) {
if (this.status === 204 || this.status === 201 ||
this.status === 200) {
switch (http) {
case "POST":
that.success({
......@@ -809,8 +820,8 @@ jIO.addStorageType("s3", function (spec, my) {
attachment_length = command.getAttachmentLength();
function removeAttachment() {
that.XHRwrapper(command, docId, attachId, 'DELETE', mime, '', true, true,
function (reponse) {
that.XHRwrapper(command, docId, attachId, 'DELETE', mime, '', true,
true, function (reponse) {
}
);
}
......@@ -988,4 +999,6 @@ jIO.addStorageType("s3", function (spec, my) {
//fin alldocs
};
return that;
});
});
}));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment