Context.ts 734 B

1234567891011121314151617181920212223
  1. // Copyright 2017-2020 @polkadot/react-components authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { QueueProps, QueueStatus, QueueTx } from './types';
  5. import React from 'react';
  6. const defaultState: Partial<QueueProps> = {
  7. stqueue: [] as QueueStatus[],
  8. txqueue: [] as QueueTx[]
  9. };
  10. const StatusContext: React.Context<QueueProps> = React.createContext<QueueProps>(defaultState as QueueProps);
  11. const QueueConsumer: React.Consumer<QueueProps> = StatusContext.Consumer;
  12. const QueueProvider: React.Provider<QueueProps> = StatusContext.Provider;
  13. export default StatusContext;
  14. export {
  15. QueueConsumer,
  16. QueueProvider
  17. };