Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help to understand the code base. #1539

Closed
RecoX opened this issue Jan 29, 2019 · 1 comment
Closed

Help to understand the code base. #1539

RecoX opened this issue Jan 29, 2019 · 1 comment
Labels

Comments

@RecoX
Copy link
Contributor

RecoX commented Jan 29, 2019

Hi, I need some recommendations from you to understand the pattern used in webtorrent-desktop as I want to use that codebase as a base of a customization project, I would like to create a new page where I can search into some trackers API, but tbh I don't know from where I can start.
As far I know there are 2 procesess, The main process (where Webtorrent is initialized) and the UI.
In src/main I believe i have all the stuff related with electron, os, and webtorrent and in src/renderer everything of the UI.

We have src/renderer/webtorrent.js that is a simple bridge between the Electron proccess and the React application, so everytime we request something from webtorrent like a file or wherever its just requesting to make it available in the UI, something like an access singletone for the view.

In the other hand we have src/renderer/main.js and its initializing the values, the controllers and over all it creates the react-dom

I see the file pages/app.js is the one who controls what view is rendered, but actually I don't understand how the react-element created in main.js is connected with this one (I don't understand the pattern).

How from here:

  // Download button toggles between torrenting (DL/seed) and paused
  // Play button starts streaming the torrent immediately, unpausing if needed
  renderTorrentButtons (torrentSummary) {
    const infoHash = torrentSummary.infoHash

    // Only show the play/dowload buttons for torrents that contain playable media
    let playButton
    if (!torrentSummary.error && TorrentPlayer.isPlayableTorrentSummary(torrentSummary)) {
      playButton = (
        <i
          key='play-button'
          title='Start streaming'
          className={'icon play'}
          onClick={dispatcher('playFile', infoHash)}>
          play_circle_outline
        </i>
      )
    }

    return (
      <div className='torrent-controls'>
        {playButton}
        <i
          key='delete-button'
          className='icon delete'
          title='Remove torrent'
          onClick={dispatcher('confirmDeleteTorrent', infoHash, false)}>
          close
        </i>
      </div>
    )
  }

When you click in the playButton you are redirected to another view? without any route or something like that? i try to read the code and but i can't see where the transition happens.

So basically to put it easy as a first example (i think...) let's say i want thetorrent-list-page page but with a player in the bottom and when I click in a audio file it will reproduce it without go to other page, which is a good approach to follow to understand how to work with this codebase??

2nd Question:
Let's say I want to move to another basecode ( i don't think so but to just know ), I would like to work with ember-electron and create an hybrid-client from there, what should I do? because in my example here:
https://github.com/refreex/refreex-desktop

I don't know how to do it

Thanks in advance

@stale
Copy link

stale bot commented Apr 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Apr 29, 2019
@stale stale bot closed this as completed May 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant