Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 19 14:49
    betheymc opened #1518
  • Oct 19 14:43
    betheymc opened #1517
  • Oct 19 14:36
    betheymc opened #1516
  • Oct 19 14:30
    betheymc opened #1515
  • Oct 15 09:28
    pasinduperera synchronize #1514
  • Oct 15 09:20
    pasinduperera synchronize #1514
  • Oct 15 09:11
    pasinduperera opened #1514
  • Oct 02 22:01
    kaiyoma opened #1513
  • Sep 30 20:20
    jfellus edited #1512
  • Sep 30 20:20
    jfellus edited #1512
  • Sep 30 20:19
    jfellus edited #1512
  • Sep 30 20:18
    jfellus edited #1512
  • Sep 30 20:18
    jfellus edited #1512
  • Sep 30 20:17
    jfellus opened #1512
  • Sep 21 09:57
    arcanis opened #1511
  • Sep 20 16:18
    reduxdj edited #1510
  • Sep 20 16:18
    reduxdj opened #1510
  • Sep 20 08:28
    mininek opened #1509
  • Aug 15 17:06
    chaffeqa opened #1508
  • Aug 08 16:07
    lierdakil closed #1507
kpgarrod
@kpgarrod
I tried extending the defs with my own interfaces but I couldn't get that to work
Nelo Mitranim
@Mitranim
@kpgarrod I started with AngularFire and quickly rolled back to the vanilla Firebase library with Fireproof for promises
suggest trying the same
AngularFire is just not productive to use, as it turns out
You'll have to include scope.$applyAsync() into callbacks but that's a small price
kpgarrod
@kpgarrod
@mitranim thanks. I gave up on angulaFire for a long time, but have had a good experience with 1.0, until now!
Nelo Mitranim
@Mitranim

It's convenient to have base viewmodel methods to shorter data sync declaration. For example:

constructor() {
  super()

  this.sync({
    langVal: this.lang,
    wordsVal: this.words
  })
}

Would be equivalent to:

constructor() {
  super()

  this.lang.on('value', snap => {
    this.langVal = snap.val()
  })
  this.words.on('value', snap => {
    this.wordsVal = snap.val()
  })
}
And when using Fireproof, you can $q.all the first complete sync
It's also easy to make directives to three-way-sync data on inputs
kpgarrod
@kpgarrod
@mitranim thank. I have a big bunch of AngularFire models (70-ish) and I'm quite happy with the way they work apart from type-checking. If I could fix the angularFire typedefs to be generic I would be smiling!
Nelo Mitranim
@Mitranim
Oh nice to hear it works for you
kpgarrod
@kpgarrod
thanks for the tip about fireproof. I also use native Firebase in some places and usually wrap it in my own $q resolve/reject. Fireproof could save me a few lines of code!
Nelo Mitranim
@Mitranim
If you're using ES6 modules and run your code outside angular factories, you might have to do angular.injector(['ng']).get('$q') initially to bless Fireproof, then re-bless it with an instance of $q from your application's injector after the application bootstrap
De Lille Felix
@flieks

@Mitranim I puted <reference paths in a tsconfig.json in the /src folder but it's not picked up in a ts file
the code

/// <reference path="../typings/aurelia/aurelia-framework.d.ts" />
/// <reference path="../typings/breeze/breeze.d.ts" />
/// <reference path="../typings/aurelia/aurelia-http-client.d.ts" />
/// <reference path="../typings/aurelia/aurelia-router.d.ts" />
/// <reference path="../typings/es6-promise/es6-promise.d.ts" />

{

    "version": "1.5.0",
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "noImplicitAny": false
    }

}

So then in a ts file (without any references) with a Promise type it fails now (it succeeded before)

Nelo Mitranim
@Mitranim
Huh no that's not what I meant :D
If no "files" property is present in a tsconfig.json, the compiler defaults to including
all files in the containing directory and subdirectories. When a "files" property is
specified, only those files are included.
De Lille Felix
@flieks
yes, but the typings folder is one folder up in the chain
Nelo Mitranim
@Mitranim
Yeah that's why I suggested you move it inside the project
Most painless setup ever
no ///reference, no extra paths for the compiler, no files, nothing
De Lille Felix
@flieks
so 1 up
Nelo Mitranim
@Mitranim
./═╦═ dist
   ╚═ src
      ╚═ app
         ╠═ typings
         ╠═ stuff
         ╚═ utils
De Lille Felix
@flieks
ok what other folder are there in the app folder ?
Nelo Mitranim
@Mitranim
echo "src/app/typings" >> .gitignore
De Lille Felix
@flieks
i only had app.ts in there
and the navbar
Nelo Mitranim
@Mitranim
tsd.json:
  "path": "src/app/typings",
  "bundle": "src/app/typings/tsd.d.ts",
De Lille Felix
@flieks
i don't have a tsd.json
Nelo Mitranim
@Mitranim
Then you're downloading typings by hand?
De Lille Felix
@flieks
yes
Nelo Mitranim
@Mitranim
npm i -g tsd
tsd init, then make the change I suggested
and run
tsd install <your dependencies> -r -s
except I'm not sure your dependencies actually exist on tsd, but you should set this up anyway
also run npm i tsd --save-dev so that it's always included with the project
also makes sense to add tsd update to postinstall in package.json -> scripts
Jonathan Park
@park9140
tsd query <dependecy> --action install —save << pre 0.6 in case anyone reads this without the line below
Nelo Mitranim
@Mitranim
@park9140 that's pre-0.6
Jonathan Park
@park9140
wait
0.6 came out
!
De Lille Felix
@flieks
tsd.json also put in /src folder ?
Nelo Mitranim
@Mitranim
yep so you can use the new syntax I listed
Nah tsd.json can live in root
You run most CLI commands from the root so tsd.json needs to be there
De Lille Felix
@flieks
ok this is my tsd at the root:
{
  "version": "v4",
  "repo": "borisyankov/DefinitelyTyped",
  "ref": "master",
  "path": "src/app/typings",
  "bundle": "src/app/typings/tsd.d.ts",
  "installed": {}
}
This message was deleted