Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Roque
jio
Commits
4a43816a
Commit
4a43816a
authored
Dec 26, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples updated
parent
08090b1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
17 deletions
+39
-17
examples/complex_example.html
examples/complex_example.html
+4
-4
examples/example.html
examples/example.html
+35
-13
No files found.
examples/complex_example.html
View file @
4a43816a
...
@@ -231,10 +231,10 @@ var command = function (method) {
...
@@ -231,10 +231,10 @@ var command = function (method) {
switch
(
method
)
{
switch
(
method
)
{
case
'
putAttachment
'
:
case
'
putAttachment
'
:
doc
.
_
id
=
$
(
'
#document_id
'
).
attr
(
'
value
'
);
doc
.
id
=
$
(
'
#document_id
'
).
attr
(
'
value
'
);
doc
.
_
rev
=
$
(
'
#prev_rev
'
).
attr
(
'
value
'
);
doc
.
rev
=
$
(
'
#prev_rev
'
).
attr
(
'
value
'
);
doc
.
_
data
=
$
(
'
#content
'
).
attr
(
'
value
'
);
doc
.
data
=
$
(
'
#content
'
).
attr
(
'
value
'
);
doc
.
_
mimetype
=
$
(
'
#mimetype
'
).
attr
(
'
value
'
);
doc
.
mimetype
=
$
(
'
#mimetype
'
).
attr
(
'
value
'
);
log
(
'
attachment:
'
+
JSON
.
stringify
(
doc
));
log
(
'
attachment:
'
+
JSON
.
stringify
(
doc
));
break
;
break
;
case
'
post
'
:
case
'
post
'
:
...
...
examples/example.html
View file @
4a43816a
...
@@ -17,6 +17,7 @@ var log = function (o) {
...
@@ -17,6 +17,7 @@ var log = function (o) {
<div
id=
"log"
>
<div
id=
"log"
>
</div>
</div>
<script
type=
"text/javascript"
src=
"../localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"../localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/md5/md5.js"
></script>
<script
type=
"text/javascript"
src=
"../jio.js"
></script>
<script
type=
"text/javascript"
src=
"../jio.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/jquery/jquery.min.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=
"../lib/base64/base64.js"
></script>
...
@@ -28,29 +29,50 @@ var log = function (o) {
...
@@ -28,29 +29,50 @@ var log = function (o) {
var
my_jio
=
null
;
var
my_jio
=
null
;
log
(
'
Welcome to the jIO example.html!
'
)
log
(
'
Welcome to the jIO example.html!
'
)
log
(
'
-
-
> Create jIO instance
'
);
log
(
'
-> Create jIO instance
'
);
my_jio
=
jIO
.
newJio
({
my_jio
=
jIO
.
newJio
({
type
:
'
local
'
,
username
:
'
jIOtest
'
,
applicationname
:
'
example
'
type
:
'
local
'
,
username
:
'
jIOtest
'
,
applicationname
:
'
example
'
});
});
log
(
'
--> put "hello" document to localStorage
'
);
// careful ! asynchronous methods
// careful ! asynchronous method
log
(
'
-> post "video" document metadata to localStorage
'
);
my_jio
.
put
({
_id
:
'
hello
'
,
content
:
'
world
'
},
function
(
val
)
{
my_jio
.
post
({
_id
:
'
video
'
,
title
:
'
My Video Title
'
,
codec
:
'
vorbis
'
,
language
:
'
en
'
,
description
:
'
Image compilation
'
},
function
(
val
)
{
log
(
'
done
'
);
log
(
'
-> put "thumbnail" attachment to localStorage
'
);
my_jio
.
putAttachment
({
id
:
"
video/thumb.jpg
"
,
data
:
"
BASE64DATA
"
,
mimetype
:
'
image/jpeg
'
},
function
(
val
)
{
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
);
});
},
function
(
err
)
{
log
(
'
Error!
'
+
err
.
reason
);
});
},
function
(
err
)
{
},
function
(
err
)
{
log
(
'
error!
'
);
log
(
'
Error!
'
+
err
.
reason
);
});
log
(
'
-> get "video" document metadata from localStorage
'
);
my_jio
.
get
(
'
video
'
,
function
(
val
)
{
log
(
'
Title is: "
'
+
val
[
"
title
"
]
+
'
"
'
);
setTimeout
(
function
()
{
log
(
'
-> remove "video" document from localStorage
'
);
log
(
'
--> get "hello" 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
);
});
my_jio
.
get
(
'
hello
'
,
function
(
val
)
{
log
(
'
done, content:
'
+
val
.
content
);
},
function
(
err
)
{
},
function
(
err
)
{
log
(
'
error!
'
);
log
(
'
Error!
'
+
err
.
reason
);
});
});
},
500
);
});
//-->
//-->
</script>
</script>
</body>
</body>
...
...
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