Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!