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
8260b650
Commit
8260b650
authored
Sep 19, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EventTarget listener assigners replaced by addEventListener method
To avoid sinon bug: fake server responds twice
parent
5f29f8dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
src/jio/core/util.js
src/jio/core/util.js
+13
-13
No files found.
src/jio/core/util.js
View file @
8260b650
...
@@ -311,9 +311,9 @@ exports.util.makeBinaryStringDigest = makeBinaryStringDigest;
...
@@ -311,9 +311,9 @@ exports.util.makeBinaryStringDigest = makeBinaryStringDigest;
function
readBlobAsBinaryString
(
blob
)
{
function
readBlobAsBinaryString
(
blob
)
{
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
fr
.
onload
=
deferred
.
resolve
.
bind
(
deferred
);
fr
.
addEventListener
(
"
load
"
,
deferred
.
resolve
.
bind
(
deferred
)
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
addEventListener
(
"
error
"
,
deferred
.
reject
.
bind
(
deferred
)
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
addEventListener
(
"
progress
"
,
deferred
.
notify
.
bind
(
deferred
)
);
fr
.
readAsBinaryString
(
blob
);
fr
.
readAsBinaryString
(
blob
);
return
deferred
.
promise
;
return
deferred
.
promise
;
}
}
...
@@ -321,9 +321,9 @@ exports.util.readBlobAsBinaryString = readBlobAsBinaryString;
...
@@ -321,9 +321,9 @@ exports.util.readBlobAsBinaryString = readBlobAsBinaryString;
function
readBlobAsArrayBuffer
(
blob
)
{
function
readBlobAsArrayBuffer
(
blob
)
{
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
fr
.
onload
=
deferred
.
resolve
.
bind
(
deferred
);
fr
.
addEventListener
(
"
load
"
,
deferred
.
resolve
.
bind
(
deferred
)
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
addEventListener
(
"
error
"
,
deferred
.
reject
.
bind
(
deferred
)
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
addEventListener
(
"
progress
"
,
deferred
.
notify
.
bind
(
deferred
)
);
fr
.
readAsArrayBuffer
(
blob
);
fr
.
readAsArrayBuffer
(
blob
);
return
deferred
.
promise
;
return
deferred
.
promise
;
}
}
...
@@ -331,9 +331,9 @@ exports.util.readBlobAsArrayBuffer = readBlobAsArrayBuffer;
...
@@ -331,9 +331,9 @@ exports.util.readBlobAsArrayBuffer = readBlobAsArrayBuffer;
function
readBlobAsText
(
blob
)
{
function
readBlobAsText
(
blob
)
{
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
fr
.
onload
=
deferred
.
resolve
.
bind
(
deferred
);
fr
.
addEventListener
(
"
load
"
,
deferred
.
resolve
.
bind
(
deferred
)
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
addEventListener
(
"
error
"
,
deferred
.
reject
.
bind
(
deferred
)
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
addEventListener
(
"
progress
"
,
deferred
.
notify
.
bind
(
deferred
)
);
fr
.
readAsText
(
blob
);
fr
.
readAsText
(
blob
);
return
deferred
.
promise
;
return
deferred
.
promise
;
}
}
...
@@ -365,14 +365,14 @@ function ajax(param) {
...
@@ -365,14 +365,14 @@ function ajax(param) {
}
}
}
}
}
}
xhr
.
onload
=
function
(
e
)
{
xhr
.
addEventListener
(
"
load
"
,
function
(
e
)
{
if
(
e
.
target
.
status
>=
400
)
{
if
(
e
.
target
.
status
>=
400
)
{
return
deferred
.
reject
(
e
);
return
deferred
.
reject
(
e
);
}
}
deferred
.
resolve
(
e
);
deferred
.
resolve
(
e
);
};
}
)
;
xhr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
xhr
.
addEventListener
(
"
error
"
,
deferred
.
reject
.
bind
(
deferred
)
);
xhr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
xhr
.
addEventListener
(
"
progress
"
,
deferred
.
notify
.
bind
(
deferred
)
);
if
(
typeof
param
.
beforeSend
===
'
function
'
)
{
if
(
typeof
param
.
beforeSend
===
'
function
'
)
{
param
.
beforeSend
(
xhr
);
param
.
beforeSend
(
xhr
);
}
}
...
...
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