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

[imports]: Want New LinkImport method to return a promise. (bugzilla: 25007) #212

Closed
hayatoito opened this issue Jul 6, 2015 · 1 comment

Comments

@hayatoito
Copy link
Contributor

Title: [imports]: Want New LinkImport method to return a promise. (bugzilla: 25007)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c0
Morrita Hajime wrote on 2014-03-11 17:23:31 +0000.

There should be a way to wait an import being loaded using Promise.
This might be better to be a part of HTML standard, but it's fine to start from here.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c1
Jake Archibald wrote on 2014-03-14 10:17:06 +0000.

Some details from the discussion at http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/042201.html

  • This should be .loaded(), "ready" will be used for non-load events, such as document.ready()
  • This should reject with InvalidStateError if href isn't set

Should promise-vending functions without arguments take onFulfilled & onRejected callbacks?

Eg, it's currently:

var promise = link.loaded().then(onFulfilled, onRejected);

Should we allow:

var promise = link.loaded(onFulfilled, onRejected);


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c2
Domenic Denicola wrote on 2014-03-14 14:35:01 +0000.

Should promise-vending functions without arguments take onFulfilled & onRejected callbacks?

I don't like this. It's a needless inconsistency in the platform that sometimes you'll be interfacing with promise objects through the normal interface and sometimes you'll be bypassing that.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c3
Dimitri Glazkov wrote on 2014-04-30 19:16:54 +0000.

Maybe replace .import with this?


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c4
Jake Archibald wrote on 2014-05-01 08:00:22 +0000.

I'm hoping we can get .loaded() on other link types (CSS, rel=preload), see http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/042201.html

Not against .import() vending a promise though, especially if a general .loaded() method meets resistance or apathy.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007#c5
Jake Archibald wrote on 2014-05-20 10:22:19 +0000.

In http://dev.w3.org/csswg/css-font-loading/#dom-fontface-loaded .loaded is a property, not a method.

link.loaded should be a property for consistency.

@TakayoshiKochi
Copy link
Member

Let me close this issue as we do not spend time on HTML Imports moving forward.

Promise-based API rather than event-based one, is a good thing, though :-(

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