webpackbin
webpackbin copied to clipboard
feature-request: Link to specific file for easy sharing
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:
https://github.com/christianalfoni/webpack-bin/issues/181
@alexilyaev Hi there! That is a good idea :-)
Basically this is what needs to be done:
Given: "bins/id?file=someFileName.js
-
In
main.js
the router needs to add propertyquery: true
, next toroutes
property. This will make the Cerebral router push queries into the signal payload -
Then the
app.binRouted
signal needs a function that checks ifprops.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')
}
Stuck due to https://github.com/cerebral/webpackbin/issues/30