put intro stuff on scheduler, not root

pull/1864/head
Rich Harris 7 years ago
parent 64387a2960
commit 85dacdbedb

@ -1,4 +1,4 @@
import { schedule_update, flush } from './scheduler.js'; import { schedule_update, flush, intro } from './scheduler.js';
import { set_current_component } from './lifecycle.js' import { set_current_component } from './lifecycle.js'
import { run_all } from './utils.js'; import { run_all } from './utils.js';
import { blankObject } from './utils.js'; import { blankObject } from './utils.js';
@ -35,10 +35,10 @@ export class SvelteComponent {
this.$$fragment = this.$$create_fragment(this, this.$$.get_state()); this.$$fragment = this.$$create_fragment(this, this.$$.get_state());
if (options.target) { if (options.target) {
this.$$intro = false; // TODO can we put this in the scheduler instead? intro.enabled = false;
this.$$mount(options.target); this.$$mount(options.target);
flush(); flush();
this.$$intro = true; intro.enabled = true;
} }
} }

@ -3,6 +3,8 @@ let update_scheduled = false;
const dirty_components = []; const dirty_components = [];
const after_update_callbacks = []; const after_update_callbacks = [];
export const intro = { enabled: false };
export function schedule_update(component) { export function schedule_update(component) {
dirty_components.push(component); dirty_components.push(component);
if (!update_scheduled) { if (!update_scheduled) {

Loading…
Cancel
Save