Skip to content

Instantly share code, notes, and snippets.

@soswow
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soswow/28547fb866c4236b4ed3 to your computer and use it in GitHub Desktop.
Save soswow/28547fb866c4236b4ed3 to your computer and use it in GitHub Desktop.
f = (n) ->
if n is 0
0
else if n is 1
1
else
f(n-1) + f(n-2)
module.exports = f
ipc = require 'ipc'
fib = require './fib'
ipc.on 'find-fib', (event, num) ->
console.log '2'
setTimeout ->
console.log '5'
event.sender.send 'fib-result', fib(45)
, 2000
console.log '3'
ipc = require 'ipc'
ipc.on 'fib-result', (result) ->
console.log '6'
console.log result
$ ->
$('#fib-start').click ->
console.log '1'
ipc.send 'find-fib', 45
console.log '4'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment