Coder Social home page Coder Social logo

Comments (9)

bramstein avatar bramstein commented on August 18, 2024

Hmm, that is an interesting question 😄

How would it work, an alternate build that uses callback with the primary option being promises?

from fontfaceobserver.

localnerve avatar localnerve commented on August 18, 2024

My simple, initial idea (untested) is that in "callback" builds, Observer.prototype.check just returns the promise executor directly, allowing the caller to supply callbacks for resolve, reject.

from fontfaceobserver.

bramstein avatar bramstein commented on August 18, 2024

I like that idea. The only downside is that FontFaceObserver can call reject or resolve multiple times. Promises take care of that transparently, but callbacks wouldn't.

from fontfaceobserver.

bramstein avatar bramstein commented on August 18, 2024

I gave this some more thought, and I think it makes sense to remove the dependency on promises. I think the benefits of a smaller size that can be inlined in the HTML document outweigh the benefits of promises. I'll change the API to only use callbacks (for those people who like promises it is very easy to convert).

from fontfaceobserver.

localnerve avatar localnerve commented on August 18, 2024

👍

from fontfaceobserver.

coryrylan avatar coryrylan commented on August 18, 2024

👍

from fontfaceobserver.

localnerve avatar localnerve commented on August 18, 2024

Is this planned for 2.x, per #19?

from fontfaceobserver.

bramstein avatar bramstein commented on August 18, 2024

Yes, it's on the schedule. Hope to get some work done on it next week (no promises though). Also, let me know if anyone else would like to take it on.

from fontfaceobserver.

bramstein avatar bramstein commented on August 18, 2024

Closing this and moving the discussion to #19.

from fontfaceobserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.