Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
How to make my TypeScript object available to a third party Javascript

I have an Angular application and need to create an API for a third party javascript that will be added dynamically.

public class MyApi{
   public callSomeFunction():void{...}
   public getSomeValue():any {...}   
}
var publicApi = new MyApi();

How do I get the publicApi object into javascripts global scope?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can add it to the global object of the client-side which is window object.

window.publicApi = new MyApi();
about 4 years ago · Santiago Trujillo Denunciar

0

If by global scope you mean window then: (window as any).publicApi = new MyApi();
If you just want to import it from other packages then export it by adding
export const publicApi = new MyApi();

And then use it depending on which module system you use:
const {publicApi} = require('./path/to/publicApi')
or
import {publicApi} from './path/to/publicApi'

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda