sciencefair-land / sciencefair

The futuristic, fabulous and free desktop app for working with scientific literature :microscope: :book:
https://sciencefair-app.com
MIT License
603 stars 52 forks source link

move contentServer to main thread #145

Closed greggraf closed 7 years ago

greggraf commented 7 years ago

More work toward #88.

Provide access to path resolve() function via IPC and use it in reader.js

I chose sendSync() vs the asynchronous send() in this case because it meant fewer changes to existing code.

I am beginning to wonder if some kind of utility function that can wrap an existing module (like contentServer.js), and automatically expose the public properties and methods as IPC events could be a useful way to keep existing modules general without needing to update them with electron IPC code. Something like:

const contentServer = IPCmainify(require('contentServer'), 'contentserver')  //(module, namespace)

would automatically create an

on("contentserver:resolve")

which would return (or wrap in a callback or both) the result of contentServer.resolve()

blahah commented 7 years ago

Sorry for the slow response @greggraf - checking it out now.

blahah commented 7 years ago

@greggraf apologies for the delay again! This week has been a long sequence of other urgent things.

All looks good to me - and I think abstracting the ipc comms would be very useful. I looked at some options but to worked well. Shall we discuss it in an issue?