Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Leo Iannacone
@LeoIannacone
anyone ?
Joe Shelby
@acroyear
we looked at it for a time, and decided that react PropTypes was enough protection for our needs.
FilipPlotnicki
@FilipPlotnicki
hi, can anyone help me with configuring alt with complex environment consisted of bts' and papug eco?
指尖上的艺术
@FingerArt
alt is not in good use at all
crazybits
@crazybits
hey
we are using alt to develop a app
and found seems the alt-container does not work on React-native 0.54.0
any hint?
Joe Shelby
@acroyear
If native 54 is like react 16, then yes, there are incompatible changes. partly with alt, but more so with alt-container. you'll need to tweak your own copy of alt to fix, i'd guess. i'm in a similar situation in trying to make sure my app is ready for 16.3.
Joe Shelby
@acroyear
so far, at least with 16.3, alt container is running fine.
Bakir Salma
@BakirRabiaSalma
Hi i have problem with dispatch,

i get this error : "dispatch is not a function " when i click add function, onAddClick() {
const { dispatch } = this.props;
dispatch(ServersActions.startEditing());

}

Bakir Salma
@BakirRabiaSalma
why i get this error
Roger Rajaratnam
@sourcier
Is this project still maintained?
Jason Rogers
@jacaetevha
@sourcier I believe it is
Joe Shelby
@acroyear
only up to a point. he did slow down development because he was working on non-react things. that said, it is remarkably stable and hasn't really needed that much new. It still works just fine with react 16.3 (i can't say the same about some other frameworks that need significantly incompatible upgrades of late).
James
@CrazyPython
Is there a convenient way to merge multiple actions classes?
James
@CrazyPython
For the record, here's how I did it:
import * as fn from 'alt/src/functions'
export let ø = {}
fn.eachObject((actionName, action) => {
    ø[actionName] = action
}, [FooDomainActions, BarDomainActions])
James
@CrazyPython
Is there a reason getInstance()is a function instead of a property? Is there a reasongetInstance() isn't a getter property? (ie one defined with get source() {return storeInstance})
James
@CrazyPython
By the way, if anyone is having trouble using Alt with Flow and WebStorm, I added some commits to my fork that remediate the problem.
James
@CrazyPython
I wrote a short snippet that lets you declare actions in a type-checker-friendly way:
class DeclarativeActionsClass {
  constructor() {
    for (const key of Object.getOwnPropertyNames(this)) {
      if(this[key] !== undefined) {
        if(this[key].isActionRequiringBinding === true) {
          this[key] = this[key].bind(this)
        }
      }
    }
  }
}
And the helper functions:
export function PassthroughAction(arity=null) {
 function generatedAction() {
   if (arity !== null) {
     const numArguments = this.arguments.length
     invariant(numArguments === arity, `Action with arity ${arity} was passed ${numArguments} parameters`)
   }
   return this.arguments
 }
 generatedAction.isActionRequiringBinding = true
 return generatedAction
}
export function IgnorePayloads() {
  /* This function ignores any parameters its given. Useful for passing an action as a React Native callback, then
   * ignoring the event itself. It's empty because it always returns undefined. */
}
IgnorePayloads.isActionRequiringBinding = true
James
@CrazyPython
Use it like this:
class StoppedCapturesActionsClass extends DeclarativeActionsClass {
  onMetadataSaveFinished = PassthroughAction()
  onPKAlbumPopulated = PassthroughAction(arity=1)
  onAlbumsArrayReady = PassthroughAction(arity=0)
  pressAlbumCover = IgnorePayloads
}
@goatslacker What do you think of this? Any chance something like it could get merged into master?
James
@CrazyPython
Alt is still very useful after customizing the internals a little bit- it may look dead, but if you use it right and have the discipline to stick to unidirectional data flow, it can be the simplest and most flexible Flux library ever.
would like to see an example in the docs of subscribing and using data from two stores in a component however.
Say you have an IgnorePayloads action and define a function callBoth that returns a function that calls the two functions its passed, with arguments. onPress={callBoth(d.pressStartNewCapture, this.setupNextAnimation)} will then work. IgnorePayloads is necessary here event callbacks receive an event as a parameter, and React re-uses events, so if you hold a reference to an event, your code won't work. This seemed like a mistake many beginners might make, and here is my declarative solution.
James
@CrazyPython
You'll need import invariant from 'invariant' for the helper functions; the function performs an assertion that doesn't run in debug mode, you can also replace it with an if statement and console.error().
James
@CrazyPython
:tada: I got Alt DevTools (the chrome extension) working with React Native! (And also inside a web worker in gneral)
image.png
Jason Rogers
@jacaetevha
:+1:
James
@CrazyPython
If you'd like to use it yourself, I've included install instructions @ https://github.com/crazypython/alt-devtool
James
@CrazyPython
Note that my fork only works with web workers and react native, not normal webpages
Joe Shelby
@acroyear
i don't need 'native', but thanks for reminding me it was there. i'd been hacking my way by just making my alt instance global (window.alt = alt = ...)
i'm using it for a web (subsonic) music player framework, along with material-ui.
James
@CrazyPython
interesting, does it support offline? (assuming http://www.subfireplayer.net/ is the correct software)
James
@CrazyPython
while I was adapting the chrome extension, there it looked like the chrome extensions API had changed for that part. if you have trouble getting it working, I can help you cherry-pick a commit from my repo to fix that bug
Joe Shelby
@acroyear
http://subfiresuite.com/ will have the new versions but they're not fully public just yet. i plan to do the full release this weekend but documenting and explaining some of my security measures (for the paranoid) will take a little time. :)
I haven't touched the extension in quite a while. still works for me, but as i'm testing the new versions i rarely use the old.
Joe Shelby
@acroyear
and no, no real offline support. it is an idea, but there's size limits on local caching of files. so the most the service worker does right now is tell the main app to show a "no network" message. security restrictions mean the app can't find any local files off the file system - it is still a PWA and that has limits to access.
i want to get a little fancier with the extension, and make sure i code it to work in firefox, too. last time i tried it in firefox, it still wasn't quite working.
James
@CrazyPython
Chrome and FireFox use the same WebExtension API, (even the "chrome" global variable is accessible on FireFox I believe), it shouldn't be difficult to get it to work on FireFox
Projects in development include a new framework for building apps more quickly (using React, Alt-Flux, and Material-UI)
care to go into a bit more detail on that?
alt-ng does exist, it's a mostly compatible version of Alt, less popular than Alt itself, new codebase koliseoapi/alt-ng#4
Alt still gets 5,000 downloads/wk
James
@CrazyPython
Perhaps instead of a chrome extension, it could be a standalone application. React Devtools has a standalone version, and https://github.com/jhen0409/react-native-debugger is React DevTools + Chrome Debugger + Redux DevTools
James
@CrazyPython
Does SubFire Radio support pulling from SoundCloud or Pandora?
James
@CrazyPython
@acroyear I got it working on firefox: just fork goatslacker/alt-devtool, add my fork as a remote, and cherry-pick f2a7f48 against your repo. Then run npm install. Then about:debugging > Load Temporary Add-on > select any file inside the cloned repo
Joe Shelby
@acroyear

SubFire Radio is just my own system. - it works on the rules, the 'generators', you configure it with. It has reference to the subsonic access (API) to last.fm info for 'similar artists' but that's the closest to external it integrates with. All the app does is configure the rules and generate playlists (which store those rules in json as comments), and then my subfire players can run those generators at runtime to create a unique play queue on demand.

i looked at alt-ng but the changes in direction don't impress me. i'm comfortable with what i have.

the framework is "subfirebase" - it has browser for bookmarks, radio playlists, regular playlists, folders/files, and artists/albums, and a loading component that loads the items as you pick them (All through react-router). then each player just has to create its framing and its player - so i have a dashboard app that is landscape mode, and simpler (no support for file/folder/artist/album browsing -- too distracting in a car), and a full portrait mode mobile player (the replacement for the chrome extension version). The framework took about 9 months, and is itself a standalone web app/PWA...it just doesn't look 'great' because that wasn't the goal. it was a proof of concept for each feature/button...then the players can pick which of those buttons/features they want to support and where they go. the all-in-one approach I tried the first time, where the same app works on a phone and works on a TV, just doesn't really scale right - it is imperfect in both and that wasn't where i wanted it to be.

I have no need for native. PWA is fine by me. I have no need to 'compete' in the webstores with the multiple Android and IOS apps already there. The only exception is the amazon store for FireOS devices (TV and Tablet), the new TV version is still a work in progress (trying to get closer to the Android TV layout specification).