question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use TC39 proposal for Symbol.observable to turn resources into Observables

See original GitHub issue

See this (+ polyfill).

The idea is that instead of monkey patching resources into Observables, we should just implement Symbol.observable on them and create an observable by passing them into Observable.from.

For example,

import {Observable} from 'rxjs';
import app from './app'; // some feathers app

const messages = app.service('messages');

const messages$ = Observable.from(messages.find()); // messages.find() has a Symbol.observable member

messages$
  .switchMap(/* whatever */)
  // etc. ...

This removes the direct dependency on RxJS and moves toward the proposed standard. See the implementation in redux.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dafflcommented, Jan 24, 2017

Thank you! This would probably also solve #41. Would be nice to implement it with the next release but I might not get to look into this until after.

0reactions
dafflcommented, Apr 25, 2018

After a little more research (inhttps://github.com/feathersjs-ecosystem/feathers-reactive/tree/symbol-observable-latest), I think we can close this. @j2L4e’s implementation of a .watch method was the way to go here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Observables - 🦋 Proposals - TC39 - Discourse
What work would it require to move forward with the proposal? If you want to propose an inter-op layer, it should be symbol-based....
Read more >
es6/MiscJSDoc.js | RxJS API Document
* `Symbol.observable` is part of https://github.com/tc39/proposal-observable proposal. * Since currently it is not supported natively, and every symbol is equal ...
Read more >
js-observables - npm Package Health Analysis
A completely custom implementation of ES7 (or ES8) Observables. With some sugar. Based on the proposal at tc39/proposal-observable.
Read more >
Building Your Own Observable Part 3
In this installment, we're going to look at RxJS's take on the Observer ... He's also championing the TC39 proposal to add observables...
Read more >
Is there a way to make a destructor for RXJS Observables?
You can optionally return a teardown function form the "subscribe function" passed to the constructor: return new Observable((observer) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found