Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const exits = []
// For every previous exitable instance...
for( let [ ctrl, el ] of previous )
// ...if it hasn't re-registered...
if( !roots.has( ctrl ) )
// It's gone! Call the exit method and keep its output.
exits.push( ctrl.exit( el ) )
// If we have exits...
if( exits.length ){
// Noop this draw
output = { subtree : 'retain' }
// Freeze the draw process
mithril.startComputation()
// ...until all exits have resolved
Promise.all( exits ).then( () => {
// We now need to revert Mithril's internal virtual DOM head so that
// it will correctly patch the live DOM to match the state in which
// components are removed: it currently believes that already happend
// Because it ran the diff before we told it to retain the subtree at
// the last minute
reverting = true
// Next draw should not patch, only diff
mithril.redraw.strategy( 'none' )
// Force a synchronous draw despite being frozen
mithril.redraw( true )
export function init(engine) {
const uiContainer = document.createElement('div');
uiContainer.id = 'ui-container';
document.body.appendChild(uiContainer);
m.startComputation();
const ctrl = m.module(uiContainer, { controller, view });
ctrl.engine = engine;
m.endComputation();
}
controller : function redirection(){
var endpoint = to.replace( paramToken, function insertParam( token, param ){
return m.route.param( param );
} );
m.startComputation();
m.route( endpoint );
m.endComputation();
},
view : emptyView
function promisify(highlandStream) {
//tell Mithril to wait for this service to complete before redrawing
m.startComputation();
var deferred = m.deferred();
highlandStream.toArray(function(results) {
deferred.resolve(results);
//the service is done, tell Mithril that it may redraw
m.endComputation();
});
return deferred.promise;
}
m.sync(requests).then(function trigger_render(){
m.startComputation();
m.endComputation();
checkFocus();
});
});
function refresh(){
m.startComputation();
m.endComputation();
}
var scanProjects = function(config) {
ipcRenderer.send('scan-projects', config.projectFolder);
m.startComputation();
}