Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all exported content apis synchronous (or provide done callback) #108

Open
NHDaly opened this issue Jan 9, 2018 · 4 comments
Open

Comments

@NHDaly
Copy link
Collaborator

NHDaly commented Jan 9, 2018

Hi! In line with #35, #41 and #56, can we make body! (and probably also content!, loadcss!, loadjs!, load!, importhtml!) synchronous?

It took me a while to track down why my app was sometimes crashing at the beginning, and it's because there's a race with loading javascript and reading it later with var = @js w varJS.

Can we just make all of those methods synchronous, following the same technique as in those other PRs? Thanks! :)

@NHDaly NHDaly changed the title Make body! synchronous (or provide done callback) Make all exported content apis synchronous (or provide done callback) Jan 9, 2018
NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 9, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.
NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 9, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.

Updates "Fade False" test to not @test_throws. Tests still pass.
@pfitzseb
Copy link
Member

Yeah, this seems like the right way forward. I'd heavily prefer having callbacks though.

@NHDaly
Copy link
Collaborator Author

NHDaly commented Jan 12, 2018

Cool, I think so too!

Do any of the functions use "done" callbacks right now? It looks like the only thing I've seen is a synchronous option implemented with the javascript Promise api. To implement a done callback, would we just have the javascript trigger a julia callback function, rather than the Promise's resolve function?

@NHDaly
Copy link
Collaborator Author

NHDaly commented Jan 12, 2018

Although actually for me personally, simply having a synchronous method is much simpler. As is, I just find myself putting sleep statements there anyway.

NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 17, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.

Updates "Fade False" test to not @test_throws. Tests still pass.
NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 17, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.

Updates "Fade False" test to not @test_throws. Tests still pass.
NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 17, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.

Updates "Fade False" test to not @test_throws. Tests still pass.
NHDaly added a commit to NHDaly/Blink.jl that referenced this issue Jan 17, 2018
Moves the fade/no-fade decision from julia down into javascript, so that
more code can be reused between the two.

This also simplifies the `content!` function body, which will make
fixing JuliaGizmos#108 a bit easier.

Updates "Fade False" test to not @test_throws. Tests still pass.
@NHDaly
Copy link
Collaborator Author

NHDaly commented Jul 25, 2018

Hi! I know it's been literally half a year, but i'm still interested in having synchronous functions for Blink! :)

I'd heavily prefer having callbacks though.

I liked what Shashi said in this comment:

If you want something to be asynchronous you can always call it with @async.

- #41 (comment)

What do you think? I'll try to look into implementing this again in a day or two!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants