8000 feature-request: Link to specific file for easy sharing · Issue #24 · cerebral/webpackbin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 28, 2018. It is now read-only.

feature-request: Link to specific file for easy sharing #24

Open
alexilyaev opened this issue May 6, 2017 · 2 comments
Open

feature-request: Link to specific file for easy sharing #24

alexilyaev opened this issue May 6, 2017 · 2 comments

Comments

@alexilyaev
Copy link
Contributor
alexilyaev commented May 6, 2017

Hi,

I'm really excited about WebpackBin.

Would be great to be able to share a link of a bin which focuses a specific file.
I was thinking we could add #filename.js or a /filename.js at the end.

@christianalfoni I"m willing to help if you could point me to where that URL logic should be written, I"m not familiar with the project.

Old issue ref:
christianalfoni/webpack-bin#181

@christianalfoni
Copy link
Member

@alexilyaev Hi there! That is a good idea :-)

Basically this is what needs to be done:

Given: "bins/id?file=someFileName.js

  1. In main.js the router needs to add property query: true, next to routes property. This will make the Cerebral router push queries into the signal payload

  2. Then the app.binRouted signal needs a function that checks if props.file exists, and if so it will make it the selected file

This should happen after the bin is grabbed from firebase:

      value(string`bins.${props`binKey`}`), {
        success: [
          when(props`value`), {
            true: [
              set(state`app.currentBinKey`, props`binKey`),
              setCurrentBin,
              // Here for example the current file is selected based on `props.file`, if exists :-)
              forceCodeUpdate,
              parallel([
                listenToBinStatsUpdates,
                whenLive, {
                  owner: connectLiveBinAsOwner,
                  participant: connectLiveBin,
                  otherwise: updateSandbox([
                    updateViewStats
                  ])
                }
              ])
            ],
            false: showSnackbar('This bin does not exist anymore, sorry', 5000, 'error')
          }
        ],
        error: showSnackbar('Unable to get BIN', 5000, 'error')
      }

@alexilyaev
Copy link
Contributor Author

Stuck due to #30

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0