Using Hype with Meteor.js

In general Hype has a garbage collection problem. This must be kept in mind when developing with reactive (shadow DOM) approaches and embedding Hype. Hype is currently not built for multiple reloads/rebuilds on a page without a hard refresh.

I did a garbage collection test here

The result is that the browser accumulates memory, listeners etc. and dynamic style sheets in the header.

When I was coding HypeTwineStage

I wrote at least a brute force routine to remove the duplicated stylesheets (jQuery version) attached:

    /* remove div's (css) from head */
    $("head").find("div").each(function() {
        $(this).remove();
    });
    /* "forget" Hype-documents */
    if (window.hasOwnProperty('HYPE')) {
        for (var n in window.HYPE.documents) delete window.HYPE.documents[n];
    }

But this is only a temporary measure and works for limited amount of reloads relying on the browsers garbage collection. For Hype to work in dynamic views one would need a "real" native unload function to truly support reactive JS.

I am not seeing this appear soon but I am hoping on it for version 4.5 or 5.

1 Like