Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
consul
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
What's new
5
Snippets
Groups
Projects
gitlab-org
build
omnibus-mirror
consul
Commits
fcf8c4e2
Commit
fcf8c4e2
authored
6 years ago
by
John Cowen
Browse files
Options
Downloads
Patches
Plain Diff
ui: Put some options in for event source runners (behind flags)
parent
14374721
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ui-v2/app/utils/dom/event-source/index.js
+54
-1
54 additions, 1 deletion
ui-v2/app/utils/dom/event-source/index.js
with
54 additions
and
1 deletion
ui-v2/app/utils/dom/event-source/index.js
+
54
−
1
View file @
fcf8c4e2
...
...
@@ -15,8 +15,61 @@ import ReopenableEventSourceFactory from 'consul-ui/utils/dom/event-source/reope
import
BlockingEventSourceFactory
from
'
consul-ui/utils/dom/event-source/blocking
'
;
import
StorageEventSourceFactory
from
'
consul-ui/utils/dom/event-source/storage
'
;
import
EmberObject
from
'
@ember/object
'
;
import
{
task
}
from
'
ember-concurrency
'
;
import
env
from
'
consul-ui/env
'
;
let
runner
;
switch
(
env
(
'
CONSUL_UI_REALTIME_RUNNER
'
))
{
case
'
ec
'
:
runner
=
function
(
target
,
configuration
,
isClosed
)
{
return
EmberObject
.
extend
({
task
:
task
(
function
*
run
()
{
while
(
!
isClosed
(
target
))
{
yield
target
.
source
.
bind
(
target
)(
configuration
);
}
}),
})
.
create
()
.
get
(
'
task
'
)
.
perform
();
};
break
;
case
'
generator
'
:
runner
=
async
function
(
target
,
configuration
,
isClosed
)
{
const
run
=
function
*
()
{
while
(
!
isClosed
(
target
))
{
yield
target
.
source
.
bind
(
target
)(
configuration
);
}
};
let
step
=
run
().
next
();
let
res
;
while
(
!
step
.
done
)
{
res
=
await
step
.
value
;
step
=
run
().
next
();
}
return
res
;
};
break
;
case
'
async
'
:
runner
=
async
function
(
target
,
configuration
,
isClosed
)
{
const
run
=
function
()
{
return
target
.
source
.
bind
(
target
)(
configuration
);
};
let
res
;
while
(
!
isClosed
(
target
))
{
res
=
await
run
();
}
return
res
;
};
break
;
default
:
// use the default runner
}
// All The EventSource-i
export
const
CallableEventSource
=
CallableEventSourceFactory
(
EventTarget
,
Promise
);
export
const
CallableEventSource
=
CallableEventSourceFactory
(
EventTarget
,
Promise
,
runner
);
export
const
ReopenableEventSource
=
ReopenableEventSourceFactory
(
CallableEventSource
);
export
const
BlockingEventSource
=
BlockingEventSourceFactory
(
ReopenableEventSource
);
export
const
StorageEventSource
=
StorageEventSourceFactory
(
EventTarget
,
Promise
);
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment