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
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
5b313b71
Commit
5b313b71
authored
Sep 16, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JIO uses promy library now
parent
5c65b9d7
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
793 deletions
+16
-793
src/jio/core/IODeferred.js
src/jio/core/IODeferred.js
+5
-7
src/jio/core/Promise.js
src/jio/core/Promise.js
+0
-775
src/jio/core/util.js
src/jio/core/util.js
+4
-4
src/jio/features/jobChecker.js
src/jio/features/jobChecker.js
+2
-2
src/jio/features/restApi.js
src/jio/features/restApi.js
+1
-1
src/jio/intro.js
src/jio/intro.js
+4
-4
No files found.
src/jio/core/IODeferred.js
View file @
5b313b71
...
@@ -160,13 +160,11 @@ IODeferred.createFromDeferred = function (method, info, options, deferred) {
...
@@ -160,13 +160,11 @@ IODeferred.createFromDeferred = function (method, info, options, deferred) {
// fail(deferred.reject.bind(deferred)).
// fail(deferred.reject.bind(deferred)).
// progress(deferred.notify.bind(deferred));
// progress(deferred.notify.bind(deferred));
// // phantomjs doesn't like 'bind'...
// // phantomjs doesn't like 'bind'...
iodeferred
.
promise
().
done
(
function
()
{
iodeferred
.
promise
.
then
(
deferred
.
resolve
.
apply
(
deferred
,
arguments
);
deferred
.
resolve
.
bind
(
deferred
),
}).
fail
(
function
()
{
deferred
.
reject
.
bind
(
deferred
),
deferred
.
reject
.
apply
(
deferred
,
arguments
);
deferred
.
notify
.
bind
(
deferred
)
}).
progress
(
function
()
{
);
deferred
.
notify
.
apply
(
deferred
,
arguments
);
});
return
iodeferred
;
return
iodeferred
;
};
};
...
...
src/jio/core/Promise.js
deleted
100644 → 0
View file @
5c65b9d7
This diff is collapsed.
Click to expand it.
src/jio/core/util.js
View file @
5b313b71
...
@@ -315,7 +315,7 @@ function readBlobAsBinaryString(blob) {
...
@@ -315,7 +315,7 @@ function readBlobAsBinaryString(blob) {
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
readAsBinaryString
(
blob
);
fr
.
readAsBinaryString
(
blob
);
return
deferred
.
promise
()
;
return
deferred
.
promise
;
}
}
exports
.
util
.
readBlobAsBinaryString
=
readBlobAsBinaryString
;
exports
.
util
.
readBlobAsBinaryString
=
readBlobAsBinaryString
;
...
@@ -325,7 +325,7 @@ function readBlobAsArrayBuffer(blob) {
...
@@ -325,7 +325,7 @@ function readBlobAsArrayBuffer(blob) {
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
readAsArrayBuffer
(
blob
);
fr
.
readAsArrayBuffer
(
blob
);
return
deferred
.
promise
()
;
return
deferred
.
promise
;
}
}
exports
.
util
.
readBlobAsArrayBuffer
=
readBlobAsArrayBuffer
;
exports
.
util
.
readBlobAsArrayBuffer
=
readBlobAsArrayBuffer
;
...
@@ -335,7 +335,7 @@ function readBlobAsText(blob) {
...
@@ -335,7 +335,7 @@ function readBlobAsText(blob) {
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
readAsText
(
blob
);
fr
.
readAsText
(
blob
);
return
deferred
.
promise
()
;
return
deferred
.
promise
;
}
}
exports
.
util
.
readBlobAsText
=
readBlobAsText
;
exports
.
util
.
readBlobAsText
=
readBlobAsText
;
...
@@ -377,7 +377,7 @@ function ajax(param) {
...
@@ -377,7 +377,7 @@ function ajax(param) {
param
.
beforeSend
(
xhr
);
param
.
beforeSend
(
xhr
);
}
}
xhr
.
send
(
param
.
data
);
xhr
.
send
(
param
.
data
);
return
deferred
.
promise
()
;
return
deferred
.
promise
;
}
}
exports
.
util
.
ajax
=
ajax
;
exports
.
util
.
ajax
=
ajax
;
...
...
src/jio/features/jobChecker.js
View file @
5b313b71
...
@@ -20,7 +20,7 @@ function enableJobChecker(jio, shared, options) {
...
@@ -20,7 +20,7 @@ function enableJobChecker(jio, shared, options) {
shared
.
job_rule_actions
=
{
shared
.
job_rule_actions
=
{
wait
:
function
(
original_job
,
new_job
)
{
wait
:
function
(
original_job
,
new_job
)
{
original_job
.
deferred
.
promise
()
.
always
(
function
()
{
original_job
.
deferred
.
promise
.
always
(
function
()
{
shared
.
emit
(
'
job
'
,
new_job
);
shared
.
emit
(
'
job
'
,
new_job
);
});
});
new_job
.
state
=
'
waiting
'
;
new_job
.
state
=
'
waiting
'
;
...
@@ -35,7 +35,7 @@ function enableJobChecker(jio, shared, options) {
...
@@ -35,7 +35,7 @@ function enableJobChecker(jio, shared, options) {
if
(
!
original_job
.
deferred
)
{
if
(
!
original_job
.
deferred
)
{
original_job
.
deferred
=
new_job
.
deferred
;
original_job
.
deferred
=
new_job
.
deferred
;
}
else
{
}
else
{
original_job
.
deferred
.
promise
()
.
original_job
.
deferred
.
promise
.
done
(
new_job
.
command
.
resolve
).
done
(
new_job
.
command
.
resolve
).
fail
(
new_job
.
command
.
reject
);
fail
(
new_job
.
command
.
reject
);
}
}
...
...
src/jio/features/restApi.js
View file @
5b313b71
...
@@ -52,7 +52,7 @@ function enableRestAPI(jio, shared) { // (jio, shared, options)
...
@@ -52,7 +52,7 @@ function enableRestAPI(jio, shared) { // (jio, shared, options)
param
.
options
=
deepClone
(
type_dict
.
object
.
shift
())
||
{};
param
.
options
=
deepClone
(
type_dict
.
object
.
shift
())
||
{};
//param.deferred = new IODeferred(method, param.kwargs, param.options);
//param.deferred = new IODeferred(method, param.kwargs, param.options);
param
.
deferred
=
new
Deferred
();
param
.
deferred
=
new
Deferred
();
promise
=
param
.
deferred
.
promise
()
;
promise
=
param
.
deferred
.
promise
;
type_dict
[
'
function
'
]
=
type_dict
[
'
function
'
]
||
[];
type_dict
[
'
function
'
]
=
type_dict
[
'
function
'
]
||
[];
if
(
type_dict
[
'
function
'
].
length
===
1
)
{
if
(
type_dict
[
'
function
'
].
length
===
1
)
{
callback
=
type_dict
[
'
function
'
].
shift
();
callback
=
type_dict
[
'
function
'
].
shift
();
...
...
src/jio/intro.js
View file @
5b313b71
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
return
define
(
dependencies
,
module
);
return
define
(
dependencies
,
module
);
}
}
if
(
typeof
exports
===
'
object
'
)
{
if
(
typeof
exports
===
'
object
'
)
{
return
module
(
exports
);
return
module
(
exports
,
require
(
'
promy
'
),
require
(
'
sha256
'
)
);
}
}
window
.
jIO
=
{};
window
.
jIO
=
{};
module
(
window
.
jIO
,
{
hex_sha256
:
hex_sha256
});
module
(
window
.
jIO
,
promy
,
{
hex_sha256
:
hex_sha256
});
}([
'
exports
'
,
'
sha256
'
],
function
(
exports
,
sha256
)
{
}([
'
exports
'
,
'
promy
'
,
'
sha256
'
],
function
(
exports
,
promy
,
sha256
)
{
"
use strict
"
;
"
use strict
"
;
var
hex_sha256
=
sha256
.
hex_sha256
;
var
hex_sha256
=
sha256
.
hex_sha256
,
Deferred
=
promy
.
Deferred
;
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