Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
b69fa9db
Commit
b69fa9db
authored
7 years ago
by
Johann-S
Committed by
XhmikosR
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix our data storage
parent
f2f69970
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/src/dom/data.js
+15
-7
js/src/dom/data.js
with
15 additions
and
7 deletions
+15
-7
js/src/dom/data.js
+
15
-
7
View file @
b69fa9db
...
...
@@ -6,10 +6,10 @@
*/
const
mapData
=
(()
=>
{
const
storeData
=
{}
const
storeData
=
{}
let
id
=
1
return
{
set
(
element
,
key
,
data
)
{
let
id
if
(
typeof
element
.
key
===
'
undefined
'
)
{
element
.
key
=
{
key
,
...
...
@@ -18,20 +18,28 @@ const mapData = (() => {
}
storeData
[
id
]
=
data
id
++
},
get
(
element
,
key
)
{
if
(
typeof
element
.
key
===
'
undefined
'
||
element
.
key
!==
key
)
{
if
(
typeof
element
.
key
===
'
undefined
'
)
{
return
null
}
const
keyProperties
=
element
.
key
return
storeData
[
keyProperties
.
id
]
if
(
keyProperties
.
key
===
key
)
{
return
storeData
[
keyProperties
.
id
]
}
return
null
},
delete
(
element
,
key
)
{
if
(
typeof
element
.
key
===
'
undefined
'
||
element
.
key
!==
key
)
{
if
(
typeof
element
.
key
===
'
undefined
'
)
{
return
}
const
keyProperties
=
element
.
key
delete
storeData
[
keyProperties
.
id
]
if
(
keyProperties
.
key
===
key
)
{
delete
storeData
[
keyProperties
.
id
]
}
}
}
})()
...
...
@@ -41,7 +49,7 @@ const Data = {
mapData
.
set
(
instance
,
key
,
data
)
},
getData
(
instance
,
key
)
{
mapData
.
get
(
instance
,
key
)
return
mapData
.
get
(
instance
,
key
)
},
removeData
(
instance
,
key
)
{
mapData
.
delete
(
instance
,
key
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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