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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
jio
Commits
9189891c
Commit
9189891c
authored
Apr 11, 2017
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tell jslint this is node scripts
parent
560504ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
Gruntfile.js
Gruntfile.js
+3
-1
src/nodejs/html5.js
src/nodejs/html5.js
+14
-14
No files found.
Gruntfile.js
View file @
9189891c
...
...
@@ -75,15 +75,17 @@ module.exports = function (grunt) {
maxlen
:
80
,
indent
:
2
,
maxerr
:
3
,
node
:
true
,
nomen
:
true
}
},
jio_nodejs_include
:
{
src
:
[
'
src/nodejs/
include
.js
'
],
src
:
[
'
src/nodejs/
*
.js
'
],
directives
:
{
maxlen
:
80
,
indent
:
2
,
maxerr
:
3
,
node
:
true
,
nomen
:
true
}
},
...
...
src/nodejs/html5.js
View file @
9189891c
(
function
(
env
)
{
"
use strict
"
;
const
process
=
require
(
"
process
"
);
var
process
=
require
(
"
process
"
);
env
.
_html5_weakmap
=
new
WeakMap
();
function
EventTarget
()
{
env
.
_html5_weakmap
.
set
(
this
,
Object
.
create
(
null
));
}
EventTarget
.
prototype
.
addEventListener
=
function
(
type
,
listener
)
{
if
(
typeof
listener
!==
"
function
"
)
return
;
const
em
=
env
.
_html5_weakmap
.
get
(
this
);
var
em
=
env
.
_html5_weakmap
.
get
(
this
);
type
=
""
+
type
;
if
(
em
[
type
])
em
[
type
].
push
(
listener
);
else
em
[
type
]
=
[
listener
];
};
EventTarget
.
prototype
.
removeEventListener
=
function
(
type
,
listener
)
{
if
(
typeof
listener
!==
"
function
"
)
return
;
const
em
=
env
.
_html5_weakmap
.
get
(
this
);
var
em
=
env
.
_html5_weakmap
.
get
(
this
);
var
i
=
0
,
listeners
=
em
[
type
];
type
=
""
+
type
;
if
(
listeners
)
for
(;
i
<
listeners
.
length
;
++
i
)
if
(
listeners
[
i
]
===
listener
)
{
...
...
@@ -24,7 +24,7 @@
}
};
EventTarget
.
prototype
.
dispatchEvent
=
function
(
event
)
{
const
type
=
""
+
event
.
type
,
var
type
=
""
+
event
.
type
,
em
=
env
.
_html5_weakmap
.
get
(
this
),
ontype
=
"
on
"
+
type
;
var
i
=
0
,
listeners
;
...
...
@@ -39,7 +39,7 @@
function
Blob
(
blobParts
,
options
)
{
// https://developer.mozilla.org/en-US/docs/Web/API/Blob
var
i
=
0
;
const
priv
=
{},
buffers
=
[];
var
i
=
0
;
var
priv
=
{},
buffers
=
[];
env
.
_html5_weakmap
.
set
(
this
,
priv
);
for
(;
i
<
blobParts
.
length
;
++
i
)
{
if
(
Buffer
.
isBuffer
(
blobParts
[
i
]))
{
...
...
@@ -67,27 +67,27 @@
FileReader
.
prototype
=
Object
.
create
(
EventTarget
.
prototype
);
Object
.
defineProperty
(
FileReader
,
"
constructor
"
,
{
value
:
FileReader
});
FileReader
.
prototype
.
readAsText
=
function
(
blob
)
{
const
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
const
text
=
priv
.
data
.
toString
();
const
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
var
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
var
text
=
priv
.
data
.
toString
();
var
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
process
.
nextTick
(()
=>
{
this
.
result
=
text
;
this
.
dispatchEvent
(
event
);
});
};
FileReader
.
prototype
.
readAsArrayBuffer
=
function
(
blob
)
{
const
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
const
arrayBuffer
=
new
Uint8Array
(
priv
.
data
).
buffer
;
const
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
var
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
var
arrayBuffer
=
new
Uint8Array
(
priv
.
data
).
buffer
;
var
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
process
.
nextTick
(()
=>
{
this
.
result
=
arrayBuffer
;
this
.
dispatchEvent
(
event
);
});
};
FileReader
.
prototype
.
readAsDataURL
=
function
(
blob
)
{
const
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
const
dataUrl
=
"
data:
"
+
blob
.
type
+
"
;base64,
"
+
priv
.
data
.
toString
(
"
base64
"
);
const
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
var
priv
=
env
.
_html5_weakmap
.
get
(
blob
);
var
dataUrl
=
"
data:
"
+
blob
.
type
+
"
;base64,
"
+
priv
.
data
.
toString
(
"
base64
"
);
var
event
=
Object
.
freeze
({
type
:
"
load
"
,
target
:
this
});
process
.
nextTick
(()
=>
{
this
.
result
=
dataUrl
;
this
.
dispatchEvent
(
event
);
...
...
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