JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q41165F
  • License ISC

expose component drag and drop events as a stream

Package Exports

  • react-announce-draggable

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-announce-draggable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Reactive Announce Draggable

Build Status npm

Installation

npm i react-announce-draggable --save

Example Usage

Auto fires three types of custom events — DRAG_START, DRAG_OVER and DROP, on the component stream.


import {draggable, droppable, consolidate}  from 'react-announce-draggable'
import {asStream} from 'react-announce'
import rx from 'rx'

const observer = new rx.Subject()

@draggable
@asStream(observer)
class Apple extends Component {
  render () {
    return (
      <div draggable="true">
        APPLE
      <div>
    )
  }
}

@droppable
@asStream(observer)
class Basket extends Component {
  render () {
    return (
      <div>
        Fruit Basket
      <div>
    )
  }
}

consolidate(observer).subscribe(x => console.log(x))

/** OUTPUT:
{picked: {component: Apple}, type: 'PICKED'},
{over: {component: Basket}, picked: {component: Apple}, type: 'DRAG'},
{over: {component: Basket}, picked: {component: Apple}, type: 'DRAG'},
{over: {component: Basket}, picked: {component: Apple}, type: 'DROP'}
**/