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
c43b0ed5
Commit
c43b0ed5
authored
Jun 19, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trigger fileAdded, fileChanged and fileRemoved event
parent
507ad945
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+14
-8
TreeView.js
apps/remix-ide/src/app/ui/TreeView.js
+0
-1
No files found.
apps/remix-ide/src/app/files/remixDProvider.js
View file @
c43b0ed5
...
...
@@ -23,10 +23,21 @@ module.exports = class RemixDProvider {
})
this
.
_appManager
.
on
(
'remixd'
,
'folderAdded'
,
(
path
)
=>
{
console
.
log
(
'event listener called'
)
this
.
event
.
trigger
(
'folderAdded'
,
[
this
.
addPrefix
(
path
)])
})
this
.
_appManager
.
on
(
'remixd'
,
'fileAdded'
,
(
path
)
=>
{
this
.
event
.
trigger
(
'fileAdded'
,
[
this
.
addPrefix
(
path
)])
})
this
.
_appManager
.
on
(
'remixd'
,
'fileChanged'
,
(
path
)
=>
{
this
.
event
.
trigger
(
'fileChanged'
,
[
this
.
addPrefix
(
path
)])
})
this
.
_appManager
.
on
(
'remixd'
,
'fileRemoved'
,
(
path
)
=>
{
this
.
event
.
trigger
(
'fileRemoved'
,
[
this
.
addPrefix
(
path
)])
})
this
.
_appManager
.
on
(
'remixd'
,
'notified'
,
(
data
)
=>
{
if
(
data
.
scope
===
'sharedfolder'
)
{
if
(
data
.
name
===
'created'
)
{
...
...
@@ -65,7 +76,7 @@ module.exports = class RemixDProvider {
}
init
(
cb
)
{
if
(
this
.
_isReady
)
return
cb
()
if
(
this
.
_isReady
)
return
cb
&&
cb
()
this
.
_appManager
.
call
(
'remixd'
,
'folderIsReadOnly'
,
{})
.
then
((
result
)
=>
{
this
.
_isReady
=
true
...
...
@@ -118,9 +129,6 @@ module.exports = class RemixDProvider {
return
this
.
_appManager
.
call
(
'remixd'
,
'set'
,
{
path
:
unprefixedpath
,
content
:
content
}).
then
(
async
(
result
)
=>
{
if
(
cb
)
return
cb
(
null
,
result
)
const
path
=
this
.
type
+
'/'
+
unprefixedpath
this
.
event
.
trigger
(
'fileChanged'
,
[
path
])
}).
catch
((
error
)
=>
{
if
(
cb
)
return
cb
(
error
)
throw
new
Error
(
error
)
...
...
@@ -140,9 +148,7 @@ module.exports = class RemixDProvider {
delete
this
.
filesContent
[
path
]
resolve
(
true
)
this
.
init
(()
=>
{
this
.
event
.
trigger
(
'fileRemoved'
,
[
path
])
})
this
.
init
()
}).
catch
(
error
=>
{
if
(
error
)
console
.
log
(
error
)
resolve
(
false
)
...
...
apps/remix-ide/src/app/ui/TreeView.js
View file @
c43b0ed5
...
...
@@ -152,7 +152,6 @@ class TreeView {
}
nodeAt
(
path
)
{
console
.
log
(
'nodeAt path: '
,
path
)
return
this
.
view
.
querySelector
(
`ul[key="
${
path
}
"]`
)
}
...
...
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