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

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.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/212

Received on Monday, 6 July 2015 07:41:11 UTC