Don't need extra get_current_component variant

pull/6920/head
Robin Munn 5 years ago
parent 86194eb2b9
commit 407213cd55

@ -11,10 +11,6 @@ export function get_current_component() {
return current_component; return current_component;
} }
export function maybe_get_current_component() {
return current_component;
}
export function beforeUpdate(fn: () => any) { export function beforeUpdate(fn: () => any) {
get_current_component().$$.before_update.push(fn); get_current_component().$$.before_update.push(fn);
} }

@ -1,5 +1,5 @@
import { run_all } from './utils'; import { run_all } from './utils';
import { maybe_get_current_component, set_current_component } from './lifecycle'; import { current_component, set_current_component } from './lifecycle';
export const dirty_components = []; export const dirty_components = [];
export const intros = { enabled: false }; export const intros = { enabled: false };
@ -35,7 +35,7 @@ const seen_callbacks = new Set();
let flushidx = 0; // Do *not* move this inside the flush() function let flushidx = 0; // Do *not* move this inside the flush() function
export function flush() { export function flush() {
const current_component = maybe_get_current_component(); const saved_component = current_component;
do { do {
// first, call beforeUpdate functions // first, call beforeUpdate functions
@ -70,7 +70,7 @@ export function flush() {
render_callbacks.length = 0; render_callbacks.length = 0;
} while (dirty_components.length); } while (dirty_components.length);
set_current_component(current_component); set_current_component(saved_component);
while (flush_callbacks.length) { while (flush_callbacks.length) {
flush_callbacks.pop()(); flush_callbacks.pop()();

Loading…
Cancel
Save