Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
Removing Extended Wrap Method From Highcharts.wrap

How am I able to manually remove/undo a wrap on a Highcharts Class Prototype?

I currently have this in a class in Angular and it seems like the wrap is holding onto my method as a closure even after the component is destroyed.

import * as Highcharts from 'highcharts';
export class ExampleComponent implements OnDestroy
     constructor() {
         function logRefresh(H) {
             H.wrap(H.Tooltip.prototype, 'refresh', function(proceed, point) {
                 proceed.apply(this, Array.prototype.slice.call(arguments, 1));
                 console.log(proceed, point);
             });
         }
         logRefresh(Highcharts);
     }

    ngOnDestroy(): void {
        ...
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The wrap method overwrites an original function in Highcharts prototype, so it is a permanent change. You can check how the method exactly works here.

As a solution, you can store an original function somewhere, for example:

H.wrap(H.Tooltip.prototype, 'refresh', function(proceed) {
  console.log('refresh');

  if (!H.Tooltip.prototype.refreshOriginal) {
    H.Tooltip.prototype.refreshOriginal = proceed;
  }

  proceed.apply(this, Array.prototype.slice.call(arguments, 1));
});

And restore it when you want.

const tooltipProto = H.Tooltip.prototype;
// restore original refresh function
tooltipProto.refresh = tooltipProto.refreshOriginal;
delete tooltipProto.refreshOriginal;

Live demo: http://jsfiddle.net/BlackLabel/nfqcwhk6/

Docs: https://www.highcharts.com/docs/extending-highcharts/extending-highcharts

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda