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

108
Vistas
Configuración de Terser para minimizar / elevar esta variable y propiedades

¿Hay alguna forma de que terser minimice/eleve this variable para que no aparezca repetida con tanta frecuencia en el paquete?

Código de ejemplo:

 class MyClass { constructor(handler) { this.handler = handler; this.handler.on('method1', this.method1.bind(this)); this.handler.on('method2', this.method2.bind(this)); this.handler.on('method3', this.method3.bind(this)); this.handler.on('method4', this.method4.bind(this)); this.handler.on('method5', this.method5.bind(this)); this.handler.on('method6', this.method6.bind(this)); this.handler.on('method7', this.method7.bind(this)); this.handler.on('method8', this.method8.bind(this)); this.handler.on('method9', this.method9.bind(this)); this.handler.on('method10', this.method10.bind(this)); } method1() {} method2() {} method3() {} method4() {} method5() {} method6() {} method7() {} method8() {} method9() {} method10() {} } new MyClass();

Idealmente, me encantaría que terser fuera inteligente para detectar usos repetidos de esto y levantar la referencia. Algo como esto:

 const a = this; a.handler.on('method1', a.method1.bind(a)); // ...

¿Qué pasa con la propiedad del handler ? Quizás también pueda ser inteligente y comprimirse aún más para:

 const a = this; const h = a.handler; // (actually, `handler` because it's argument var) h.on('method1', a.method1.bind(a)); // ...
about 4 years ago · Juan Pablo Isaza
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