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

Subject: NPM vs github and cyclical dependencies?

I'm trying to build them from source and completely remove any reference to the FB flux dispatcher entirely. The "BSD+Patents" has not been changed for flux at all (and by holding to the older version, it means holding to an older version of fbjs which also has not been re-licensed the way 0.8.16 has). This is a blocker for my project; I'm only allowed MIT items.

And in trying to run the tests of the other items (utils, container), I'm finding dependency issues.

The npm package of 0.18.6 seems to include some of alt-utils and AltContainer in it. This allows the github drop of the separate alt-utils to have access to AltContainer. However, if I instead point my alt-utils to my local copy of alt (necessary because again I don't want that flux to ever be downloaded), those files are missing. They're in npm but not github for plain 'alt'.

This means I can't fully run the unit tests of alt-utils to be sure I've not broken anything with my alternate dispatcher. It is also worrysome in that by installing both alt and alt-container from npm, I'm getting two copies of alt-container and not sure if I'm actually running the most stable version.

Any comments on how I could deal with this?

Akash Vishwakarma
@akashishu777
What is the use of Alt js ?
Karan Kotwal
@kkotwal94
its similar to that of redux homie
its a react flux implementation
I was like 18 when I wrote this pls no flamerino
I thought the api was really straightforward for a newcomer.
Ash McConnell
@AshMcConnell
Hi Folks, I'm just looking at the tutorial now, one bit I don't get, are the action constants like LocationActions.UPDATE_LOCATIONS automatically generated somehow
Joe Shelby
@acroyear
there is a method generateActions that does that. depending on how the action is 'scoped' it may be under alt.actions.globalactions or alt.actions.myactionclass.actions usually the latter

class CredentialsActions {
constructor() {
this.generateActions('saveCredentials', 'doLogin');
}
}

export default alt.createActions(CredentialsActions);

those two together produce alt.actions.CredentialsActions.saveCredentials and doLogin for me. that wraps all the picky details about SAVE_CREDENTIALS so i don't have to deal with it.

Leo Iannacone
@LeoIannacone
typescirpt ?
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.