Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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).

the framework contains the alt actions, stores, dispatcher, even the alt-containers. i just need to instantiate the alt-containers in my App.js and I get it all in the app.
James
@CrazyPython
oh, I thought you meant a general framework that tied those 3 together for any application at all
Joe Shelby
@acroyear
no, very specific to being a subsonic music player app
i can't really see a way to make things more 'generic' - stores and actions are domain specific, your material-ui views are what they are.
Borislavsl
@Borislavsl
Can you show me where I can find materials for React + Alt .js
(except Alt Docs)?
Jovica Aleksic
@loopmode
Hi everybody. Just want to say hi and drop two cents :) because I'm delighted there is still activity in here!
I have a heavily customized alt, or rather something based on alt, in use for really long now in a big project, and I must agree with some of the messages posted here recently: Yes, alt is remarkably stable, and flexible as hell.
I think the only "weak point" is that it's "too flexible": You can achieve things in many different ways, and as a beginner, you just can't tell which one to choose, even or especially after reading the docs. But I still love it. I hope some day I find the time to polish, document and release my remix of alt.
Anyways, cheers to all, and happy coding
hachtr
@hachtr
Question for folks here, is there an actively maintained fork of Alt.js that anyone knows of?
I saw some references to a fork in previous comments but no links.
Jason Rogers
@jacaetevha
@hachtr what would you want a fork to do? Why not get in contact with @goatslacker and ask if you can help with this repo? Or start picking off issues and creating pull requests?
hachtr
@hachtr
@jacaetevha my understanding is @goatslacker isn't updating alt anymore given no updates have been since Sep 8, 2016. I'm mainly looking for updates with the type definitions and using alt with Typescript. I've looked at what is currently there and have had trouble getting it to work in our code base. Also my understanding is Alt Containers use the older React Context API.
Jason Rogers
@jacaetevha

@hachtr my earlier suggestions still stand... Why not get in contact with @goatslacker and ask if you can help with this repo? Or start picking off issues and creating pull requests?

Or, why not ask @goatslacker if you can take over the project?

saeed karami
@saeedkarami_gitlab

hi i want add new makeSelector add to project but this err TypeError: Cannot read property 'toJS' of undefined
(anonymous function)
src/store/ducks/inventories/selectors.js:26
23 |
24 | export const makeSelectProcurements = createSelector(
25 | selectProcurements,

26 | (substate) => substate.toJS(),
27 | );
28 |
29 |

Mateusz
@malaskow
hi there, just one question - does it works with react 16.X?
Jason Rogers
@jacaetevha
Yes. We've been using it with 16.x for over a year now at ISS.
Dan Sadaka
@dsadaka
Greetings everone.