Problem/Motivation

"A Promise is a programming model that deals with deferred results in concurrent programming. The basic idea around promises are that rather than issuing a blocking call for a resource (IO, Network, etc.) you can immediately return a promise for a future value that will eventually be fulfilled. This allows you to write non-blocking logic that executes asynchronously without having to write a lot of synchronization and plumbing code." - source: http://blogs.msdn.com/b/rbuckton/archive/2010/01/29/promises-and-futures...

"In short, a promise decouples the callback from the function call, while providing a more flexible method of executing callbacks for code that is potentially asynchronous."

DOM Promises are now apart of the "Living Standard" for DOM - source: http://dom.spec.whatwg.org/#i-promise-you-an-introduction

Proposed resolution

With our use of JavaScript in Drupal we may be able to refactor our code to either use native support for DOM Promises or some kind of additional library like Promise.js ( http://blogs.msdn.com/b/rbuckton/archive/2011/08/15/promise-js-2-0-promi... ) to handle this task.

Remaining tasks

User interface changes

API changes

Comments

nod_’s picture

It's D8 material if you're feeling like refactoring ajax.js :D

cosmicdreams’s picture

Hiya nod_, good to know. However, browser support needs to catch up. Firefox and Chrome will have support for DOM Promises without polyfill by next release. Don't know when IE will ever provide support. I targetted this at Drupal 9 so the plan for the conversion could be fleshed out for when this feature has critical mass.

cosmicdreams’s picture

Issue summary: View changes

Updated issue summary.

nod_’s picture

Category: bug » task

not a bug

nod_’s picture

Issue summary: View changes

Updated issue summary.

catch’s picture

Version: 9.x-dev » 8.3.x-dev

Nothing makes this entirely 9.x-only yet.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.