first: function()

in src/toolkit.js [139:170]


    first: function(bodyElm) {
        // console.log(layersNode);
        if (layersNodeApp) {
            layersNode = layersNodeApp.embed(bodyElm);
            layersNode.ports.resize.send([ 700, 700 ]);
            if (window.location.hash && (window.location.hash.indexOf('#blends=' > 0))) {
                const newBlends = window.location.hash.slice(8);
                layersNode.ports.applyAllBlends.send(newBlends);
            }
            if (elmsfeuer) {
                layersNode.ports.sendNewBlend.subscribe(function(state) {
                    const { layer, blend } = state;
                    if (blend && blend[0]) {
                        elmsfeuer.ports.changeWGLBlend.send({ layer, blend : blend[0] });
                    } else if (blend && blend[1]) {
                        elmsfeuer.ports.changeHtmlBlend.send({ layer, blend : blend[1] });
                    }
                });
            }
            layersNode.ports.sendNewCode.subscribe(function(code) {
                window.location.hash = '#blends=' + code;
            });
            layersNode.ports.sendNewColors.subscribe(function(state) {
                // FIXME: remove the handler in palette node and use this one
                //        for updates,
                //        but actually those colors are for blends instead
                if (updateFssColors) {
                    updateFssColors(state.layer, state.colors);
                }
            });
        }
    },