Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
4013d352
Commit
4013d352
authored
May 24, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return a promise if mappings alrady requested
parent
075fa4ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
22 deletions
+26
-22
storageViewer.js
src/storage/storageViewer.js
+26
-22
No files found.
src/storage/storageViewer.js
View file @
4013d352
...
...
@@ -11,6 +11,7 @@ class StorageViewer {
constructor
(
_context
,
_storageResolver
,
_traceManager
)
{
this
.
context
=
_context
this
.
storageResolver
=
_storageResolver
this
.
completeMapingsLocationPromise
=
null
_traceManager
.
accumulateStorageChanges
(
this
.
context
.
stepIndex
,
this
.
context
.
address
,
{},
(
error
,
storageChanges
)
=>
{
if
(
!
error
)
{
this
.
storageChanges
=
storageChanges
...
...
@@ -71,30 +72,33 @@ class StorageViewer {
* @param {Function} callback
*/
async
mappingsLocation
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
completeMappingsLocation
)
{
return
resolve
(
this
.
completeMappingsLocation
)
}
this
.
storageResolver
.
initialPreimagesMappings
(
this
.
context
.
tx
,
this
.
context
.
stepIndex
,
this
.
context
.
address
,
(
error
,
initialMappingsLocation
)
=>
{
if
(
error
)
{
reject
(
error
)
}
else
{
this
.
extractMappingsLocationChanges
(
this
.
storageChanges
,
(
error
,
mappingsLocationChanges
)
=>
{
if
(
error
)
{
return
reject
(
error
)
}
this
.
completeMappingsLocation
=
Object
.
assign
({},
initialMappingsLocation
)
for
(
var
key
in
mappingsLocationChanges
)
{
if
(
!
initialMappingsLocation
[
key
])
{
initialMappingsLocation
[
key
]
=
{}
}
this
.
completeMappingsLocation
[
key
]
=
Object
.
assign
({},
initialMappingsLocation
[
key
],
mappingsLocationChanges
[
key
])
}
resolve
(
this
.
completeMappingsLocation
)
})
if
(
!
this
.
completeMapingsLocationPromise
)
{
this
.
completeMapingsLocationPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
completeMappingsLocation
)
{
return
this
.
completeMappingsLocation
}
this
.
storageResolver
.
initialPreimagesMappings
(
this
.
context
.
tx
,
this
.
context
.
stepIndex
,
this
.
context
.
address
,
(
error
,
initialMappingsLocation
)
=>
{
if
(
error
)
{
reject
(
error
)
}
else
{
this
.
extractMappingsLocationChanges
(
this
.
storageChanges
,
(
error
,
mappingsLocationChanges
)
=>
{
if
(
error
)
{
return
reject
(
error
)
}
this
.
completeMappingsLocation
=
Object
.
assign
({},
initialMappingsLocation
)
for
(
var
key
in
mappingsLocationChanges
)
{
if
(
!
initialMappingsLocation
[
key
])
{
initialMappingsLocation
[
key
]
=
{}
}
this
.
completeMappingsLocation
[
key
]
=
Object
.
assign
({},
initialMappingsLocation
[
key
],
mappingsLocationChanges
[
key
])
}
resolve
(
this
.
completeMappingsLocation
)
})
}
})
})
})
}
return
this
.
completeMapingsLocationPromise
}
/**
...
...
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