Opened 9 years ago

Closed 9 years ago

#13546 closed New Feature (wontfix)

Incorporate promises framework into CKEditor.

Reported by: Steve James Owned by:
Priority: Normal Milestone:
Component: Performance Version: 4.6.0
Keywords: promises framework Cc:

Description

One of the aspects of CKEditor that gives me regular headaches is that while the editor obviously needs to do many of its internal tasks asynchronously, the callback interface for determining when CKEditor is "done" sometimes does not work exactly as expected. I end up putting a bunch of setTimeOuts in place to manage your code execution in addition to your established callbacks. Performance and best approach varies by browser and by device. Recently, I took a look at your code and was surprised to find 101 setTimeOuts (some of those non-zero durations are obviously guesses), but very little in the way of a promises/deferred framework, which is what I was hoping to find.

Obviously, you need some of the setTimeOuts to deal with the async nature of what you are doing, and even promises are essentially using setTimeOuts. However, how about considering "baking in" some sort of promises/deferred framework in the future as a better performing approach and giving us a better interface to running async editor tasks as a side-benefit? You could do this with a basic promises plugin (or build it into the core) that the jQuery adapter could override to make the editor use the jQuery promises implementation. (I realize that jQuery's promises implementation is deemed flawed by some, but if jQuery is in use, why not just use their framework.)

Also, as you are adding more functionality that would benefit from using a robust promises framework (e.g., the new file uploads functionality), I think it would be worth having a serious look at this.

Change History (1)

comment:1 Changed 9 years ago by Piotrek Koszuliński

Resolution: wontfix
Status: newclosed

We already made a decision to use promises in CKEditor 5. Related thread in the design repo – https://github.com/ckeditor/ckeditor5-design/issues/43 (I can't see this mentioned in that thread but we decided to go with ES6 promises.)

As for CKEditor 4, there's not much we can do now. It's simply too late. And as for the timeouts – huge number of them is supposed to workaround some browsers issues (e.g. asynchronous and unstable focus) and there is no other way than guessing. Some of those will even need to appear in CKE5 even though promises will be used. That's the sad part of development :(. But you're right that in many places, many things could've been implemented differently.

I'm closing this ticket because there's nothing in CKE4 that we can work on now.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy