Skip to content

Documentation / @andrew_l/context / onScopeDispose

Function: onScopeDispose() ​

onScopeDispose(fn): void

The callback will be invoked when the associated context completes.

Parameters ​

fn ​

() => void

Returns ​

void

Example ​

ts
const fn = withContext(() => {
  onScopeDispose(() => {
    console.log(2);
  });

  console.log(1);
});

fn();

console.log(3);

// 1
// 2
// 3