Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

disposable-component

Package Overview
Dependencies
Maintainers
12
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disposable-component - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

lib/rx4.js

23

package.json
{
"name": "disposable-component",
"version": "0.4.0",
"version": "0.4.1",
"description": "A simple reactive API for mounting and unmounting components to the DOM",
"main": "lib/rx6.js",
"main": "lib/rx4.js",
"repository": "https://github.com/CanopyTax/disposable-component",

@@ -19,16 +19,15 @@ "author": "Bret Little <bret.little@gmail.com>",

"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-transform-modules-umd": "^7.2.0",
"@babel/preset-env": "^7.4.3",
"@babel/preset-env": "^7.2.3",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^24.7.1",
"browserslist-config-canopy": "^3.1.0",
"babel-jest": "^23.6.0",
"browserslist-config-canopy": "^2.0.0",
"in-publish": "^2.0.0",
"jest": "^24.7.1",
"rimraf": "^2.6.3"
"jest": "^23.6.0",
"rimraf": "^2.6.2",
"rx": "^4.1.0",
"rxjs": "^6.3.3"
},
"dependencies": {
"rxjs": "^6.4.0"
},
"files": [

@@ -35,0 +34,0 @@ "lib",

@@ -12,3 +12,3 @@ # disposable-component

```
npm install --save disposable-component
npm install --save rx disposable-component
```

@@ -21,9 +21,9 @@

```js
import mountComponent from "disposable-component";
import React from "react";
import ReactDOM from "react-dom";
import mountComponent from "disposable-component";
function showModal(El, props) {
return mountComponent(
function mount(next, complete, error) {
function mount(onNext, onCompleted, onError) {
el = document.createElement("div");

@@ -33,3 +33,3 @@ document.body.appendChild(el);

ReactDOM.render(
<El {...props} close={complete} next={next} />,
<El {...props} close={onCompleted} onNext={onNext} />,
el

@@ -49,4 +49,4 @@ );

<h1>My Modal</h1>
<button onClick={this.props.complete}>Close</button>
<button onClick={this.props.next.bind(null, 1)}>Save</button>
<button onClick={this.props.onCompleted}>Close</button>
<button onClick={this.props.onNext.bind(null, 1)}>Save</button>
</div>

@@ -59,3 +59,3 @@ );

subscription.unsubscribe(); // close the modal
subscription.dispose(); // close the modal
```

@@ -1,6 +0,6 @@

import { Observable } from "rxjs";
import { finalize } from "rxjs/operators";
import { Observable } from "rxjs"
import { finalize } from "rxjs/operators"
export default function mountDisposableComponent(mount, unmount) {
return Observable.create(observer => {
return Observable.create( observer => {
mount(

@@ -10,4 +10,6 @@ observer.next.bind(observer),

observer.error.bind(observer)
);
}).pipe(finalize(unmount));
}
)
}).pipe(
finalize(unmount)
)
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc