Skip to content

Commit

Permalink
feat(periodicWave): Real PeriodicWave instances are now accepted for …
Browse files Browse the repository at this point in the history
…setPeriodicWave()
  • Loading branch information
meszaros-lajos-gyorgy committed Sep 21, 2018
1 parent abdfeb1 commit 28acc50
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from 'ramda'

import { CTX_DESTINATION, EVENTS } from './constants'
import VirtualPeriodicWave from './VirtualPeriodicWave'

const invertEvent = cond([
[propEq('eventName', EVENTS.CREATE), assoc('eventName', EVENTS.REMOVE)],
Expand Down Expand Up @@ -115,9 +116,13 @@ const applyEventToContext = curry(({ targetId, eventName, param, time, args }, c
apply(node[command].bind(node), args)
break
case 'setPeriodicWave':
const nodeId = args[0]._.id // args[0] is a VirtualPeriodicWave, but we need the real one
const argNode = getNodeById(nodeId, ctx)
node[command](argNode)
if (args[0] instanceof VirtualPeriodicWave) {
const nodeId = args[0]._.id // args[0] is a VirtualPeriodicWave, but we need the real one
const argNode = getNodeById(nodeId, ctx)
node[command](argNode)
} else {
node[command](args[0])
}
break
default: {
console.error('unknown command', command)
Expand Down

0 comments on commit 28acc50

Please sign in to comment.