Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
jio
Commits
72133321
Commit
72133321
authored
Jun 20, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example.html updated
parent
935d3e28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
38 deletions
+54
-38
examples/example.html
examples/example.html
+54
-38
No files found.
examples/example.html
View file @
72133321
...
...
@@ -8,9 +8,9 @@
<script
type=
"text/javascript"
>
<!--
var
log
=
function
(
o
)
{
var
node
=
document
.
createElement
(
'
div
'
);
node
.
textContent
=
o
;
document
.
getElementById
(
'
log
'
).
appendChild
(
node
);
var
node
=
document
.
createElement
(
'
div
'
);
node
.
textContent
=
o
;
document
.
getElementById
(
'
log
'
).
appendChild
(
node
);
};
//-->
</script>
...
...
@@ -21,60 +21,76 @@ var log = function (o) {
<script
type=
"text/javascript"
src=
"../src/jio.storage/localstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"../lib/jquery/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/base64/base64.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/davstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"../lib/jsSha2/sha2.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/revisionstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"../lib/sjcl/sjcl.min.js"
></script>
<script
type=
"text/javascript"
>
<!--
var
my_jio
=
null
;
var
jio_instance
=
null
;
log
(
'
Welcome to the jIO example.html!
'
)
log
(
'
-> Create jIO instance
'
);
log
(
'
Welcome to the jIO example.html!
'
)
log
(
'
-> Create jIO instance
'
);
my_jio
=
jIO
.
newJio
({
type
:
'
local
'
,
username
:
'
jIOtest
'
,
applicationname
:
'
example
'
jio_instance
=
jIO
.
newJio
({
"
type
"
:
'
local
'
,
"
username
"
:
'
jIOtest
'
,
"
applicationname
"
:
'
example
'
});
// careful ! asynchronous methods
log
(
'
-> post "video" document metadata to localStorage
'
);
my_jio
.
post
({
_id
:
'
video
'
,
title
:
'
My Video Title
'
,
codec
:
'
vorbis
'
,
language
:
'
en
'
,
description
:
'
Image compilation
'
},
function
(
val
)
{
// Careful! These are asynchronous methods!
log
(
'
-> post "video" document metadata to localStorage
'
);
jio_instance
.
post
({
"
_id
"
:
'
video
'
,
"
title
"
:
'
My Video Title
'
,
"
codec
"
:
'
vorbis
'
,
"
language
"
:
'
en
'
,
"
description
"
:
'
Image compilation
'
},
function
(
response
)
{
log
(
'
-> put "thumbnail" attachment to localStorage
'
);
log
(
'
-> put "thumbnail" attachment to localStorage
'
);
my_jio
.
putAttachment
({
id
:
"
video/thumb.jpg
"
,
data
:
"
BASE64DATA
"
,
mimetype
:
'
image/jpeg
'
},
function
(
val
)
{
jio_instance
.
putAttachment
({
"
_id
"
:
"
video
"
,
"
_attachment
"
:
"
thumb.jpg
"
,
"
_data
"
:
"
BASE64DATA
"
,
"
_mimetype
"
:
'
image/jpeg
'
},
function
(
response
)
{
log
(
'
-> put "video" attachment to localStorage
'
);
my_jio
.
putAttachment
({
id
:
"
video/myvideo.ogg
"
,
data
:
"
BASE64DATATOO
"
,
mimetype
:
'
video/ogg
'
},
function
(
val
)
{
log
(
'
Done! Refresh the page to see get and remove command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
log
(
'
-> put "video" attachment to localStorage
'
);
jio_instance
.
putAttachment
({
"
_id
"
:
"
video
"
,
"
_attachment
"
:
"
myvideo.ogg
"
,
"
_data
"
:
"
BASE64DATATOO
"
,
"
_mimetype
"
:
'
video/ogg
'
},
function
(
val
)
{
log
(
'
Done! Refresh the page to see get and remove command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
Error!
'
+
err
.
reason
);
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
-> get "video" document metadata from localStorage
'
);
my_jio
.
get
(
'
video
'
,
function
(
val
)
{
log
(
'
Title is: "
'
+
val
[
"
title
"
]
+
'
"
'
);
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
-> get "video" document metadata from localStorage
'
);
jio_instance
.
get
(
'
video
'
,
function
(
val
)
{
log
(
'
-> remove "video" document from localStorage
'
);
my_jio
.
remove
({
_id
:
'
video
'
},
function
(
val
)
{
log
(
'
Done! Refresh the page to see post and putAttachment command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
log
(
'
Title is: "
'
+
val
[
"
title
"
]
+
'
"
'
);
log
(
'
-> remove "video" document from localStorage
'
);
jio_instance
.
remove
({
"
_id
"
:
'
video
'
},
function
(
val
)
{
log
(
'
Done! Refresh the page to see post and putAttachment command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
Error!
'
+
err
.
reason
);
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
});
//-->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment