Coder Social home page Coder Social logo

Comments (6)

renestalder avatar renestalder commented on August 18, 2024 1

Yeah well I see, that was my fault. I have some kind of babel/typescript stuff in my build that makes it possible to import JavaScript files when a specific export standard of another module system is applied. So I then can import some libraries directly instead of loading it globally, which doesn't work in that case. But of course It does when I add it globally. Thanks for your feedback.

from fontfaceobserver.

fela98 avatar fela98 commented on August 18, 2024

+1
I would really appreciate a TypeScript definition file

from fontfaceobserver.

bramstein avatar bramstein commented on August 18, 2024

Sure! That sounds like a good idea. Pull request welcome 👍

from fontfaceobserver.

drewsilcock avatar drewsilcock commented on August 18, 2024

For anyone still wondering about this, there is a typings that can be installed using typings:

typings install --global --save-dev dt~fontfaceobserver

Actual typings file is here:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/354cec620daccfa0ad167ba046651fb5fef69e8a/types/fontfaceobserver/index.d.ts

from fontfaceobserver.

renestalder avatar renestalder commented on August 18, 2024

Someone used this and can explain how this works? because it has no default export.

from fontfaceobserver.

drewsilcock avatar drewsilcock commented on August 18, 2024

Including the JavaScript file adds window.FontFaceObserver, which allows you to do new FontFaceObserver(fontName) without importing anything. The Typings file just tells TypeScript that FontFaceObserver is a global thing and basically not to worry about it, allowing you to do new FontFaceObserver(fontName) in TypeScript and get those yummy typings and autocompletions and intellisense. This is why you pass the --global flag in when you do the typings install.

tldr; you don't need to import anything, you can just use it.

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.