observable.js 546 B

12345678910111213141516
  1. /* eslint-disable @typescript-eslint/no-var-requires */
  2. // Copyright 2017-2019 @polkadot/react-query authors & contributors
  3. // This software may be modified and distributed under the terms
  4. // of the Apache-2.0 license. See the LICENSE file for details.
  5. const createObservable = require('@polkadot/api-rx/observable');
  6. module.exports = function observable (method) {
  7. const fn = () => Promise.resolve(12345);
  8. fn.unsubscribe = () => Promise.resolve(true);
  9. return createObservable(`section_${method}`, method, {
  10. [method]: fn
  11. })();
  12. };