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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
jio
Commits
dba374fb
Commit
dba374fb
authored
Aug 29, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example.html updated
parent
3701d2c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
34 deletions
+48
-34
examples/example.html
examples/example.html
+48
-34
No files found.
examples/example.html
View file @
dba374fb
...
...
@@ -16,11 +16,10 @@ var log = function (o) {
</script>
<div
id=
"log"
>
</div>
<script
type=
"text/javascript"
src=
"../lib/md5/md5.js"
></script>
<script
type=
"text/javascript"
src=
"../jio.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/localstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"../lib/jquery/jquery.min.js"
></script>
<script
src=
"../src/sha256.amd.js"
></script>
<script
src=
"../jio.js"
></script>
<script
src=
"../complex_queries.js"
></script>
<script
src=
"../src/jio.storage/localstorage.js"
></script>
<script
type=
"text/javascript"
>
<!--
var
jio_instance
=
null
;
...
...
@@ -28,7 +27,7 @@ var jio_instance = null;
log
(
'
Welcome to the jIO example.html!
'
)
log
(
'
-> Create jIO instance
'
);
jio_instance
=
jIO
.
newJio
({
jio_instance
=
jIO
.
createJIO
({
"
type
"
:
'
local
'
,
"
username
"
:
'
jIOtest
'
,
"
applicationname
"
:
'
example
'
...
...
@@ -43,52 +42,67 @@ jio_instance.post({
"
codec
"
:
'
vorbis
'
,
"
language
"
:
'
en
'
,
"
description
"
:
'
Image compilation
'
}
,
function
(
response
)
{
}
).
then
(
function
(
)
{
log
(
'
-> put "thumbnail" attachment to localStorage
'
);
jio_instance
.
putAttachment
({
return
jio_instance
.
putAttachment
({
"
_id
"
:
"
video
"
,
"
_attachment
"
:
"
thumb.jpg
"
,
"
_data
"
:
"
BASE64DATA
"
,
"
_data
"
:
"
This is the thumbnail content
"
,
"
_mimetype
"
:
'
image/jpeg
'
},
function
(
response
)
{
});
}).
then
(
function
()
{
log
(
'
-> put "video" attachment to localStorage
'
);
jio_instance
.
putAttachment
({
return
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
);
"
_data
"
:
new
Blob
([
"
This is the video content
"
],
{
"
type
"
:
"
video/ogg
"
})
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
}
);
}).
then
(
function
(
response
)
{
log
(
'
Done! Refresh the page to see get and remove command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
Error!
'
+
err
.
statusText
+
"
:
"
+
err
.
reason
+
"
,
"
+
err
.
message
);
log
(
'
-> get "video" document metadata from localStorage
'
);
jio_instance
.
get
(
'
video
'
,
function
(
val
)
{
jio_instance
.
get
({
"
_id
"
:
"
video
"
}).
then
(
function
(
response
)
{
log
(
'
Title is: "
'
+
response
.
data
.
title
+
'
"
'
);
log
(
'
-> get "video" attachment content
'
);
return
jio_instance
.
getAttachment
({
"
_id
"
:
"
video
"
,
"
_attachment
"
:
"
myvideo.ogg
"
});
}).
then
(
function
(
response
)
{
log
(
'
Title is: "
'
+
val
[
"
title
"
]
+
'
"
'
);
return
jIO
.
util
.
blobAsBinaryString
(
response
.
data
);
}).
then
(
function
(
binary_string
)
{
log
(
'
Video content is:
'
+
binary_string
);
log
(
'
-> remove "video" document from localStorage
'
);
jio_instance
.
remove
({
"
_id
"
:
'
video
'
},
function
(
val
)
{
return
jio_instance
.
remove
({
"
_id
"
:
'
video
'
});
}).
then
(
function
(
response
)
{
log
(
'
Done! Refresh the page to see post and putAttachment command.
'
);
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
log
(
'
Error!
'
+
err
.
statusText
+
"
:
"
+
err
.
reason
+
"
,
"
+
err
.
message
);
});
});
...
...
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