Platform
Resources
Pricing
Sign in
Get started
Jesse Varnado
Workspace
Fork
Published
By
Jesse Varnado
Edited
Dec 17, 2018
Insert cell
Insert cell
(
async
function
(
)
{
const
foo
=
new
Foo
(
)
;
return
bluebird
.
mapSeries
(
[
(
)
=>
foo
.
bar
,
// setting a value on an async setter returns the value in the right hand assignment not the promise
// returned by the async setter, because the return value of a setter is alway discarded
(
)
=>
{
return
foo
.
bar
=
2
}
,
(
)
=>
foo
.
bar
,
]
,
(
fn
)
=>
{
const
result
=
fn
(
)
;
return
bluebird
.
props
(
{
thenable
:
!
!
result
&&
!
!
result
.
then
,
result
}
)
;
}
)
;
}
)
(
)
Insert cell
class
Foo
{
constructor
(
)
{
this
.
_bar
=
1
;
}
get
bar
(
)
{
return
bluebird
.
delay
(
100
)
.
return
(
this
.
_bar
)
;
}
set
bar
(
value
)
{
return
bluebird
.
delay
(
100
)
.
then
(
(
)
=>
{
return
this
.
_bar
=
value
}
)
;
}
}
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Foo
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bluebird
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML