Skip to content

Instantly share code, notes, and snippets.

@prewk
prewk / observe-property.ts
Created March 22, 2022 12:07 — forked from dscheerens/observe-property.ts
Property observe function
import { BehaviorSubject, Observable } from 'rxjs';
/**
* Observes the specified property and returns a stream that emits all values which are assigned to the property. When subscribing to the
* resulting stream it will always first emit the current value of the property, followed by all new values that are assigned to it.
*
* @param target Object containing the property.
* @param key Key of the property that is to be observed.
* @returns A stream of all values that are assigned to the specified property, starting with the current value of the property.
*/
@prewk
prewk / component.jsx
Last active January 13, 2016 13:09 — forked from anonymous/component
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
import {Link} from 'react-router';
export default class Header extends Component {
static propTypes = {
msg: PropTypes.object.isRequired,
pathname: PropTypes.string.isRequired,
viewer: PropTypes.object