Meteor-Community-Packages / ground-db

GroundDB is a thin layer providing Meteor offline database and methods

Home Page:https://atmospherejs.com/ground/db

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"loaded" event in Meteor 1.3

Obiwarn opened this issue · comments

seems to not get fired anymore in 1.3?

This happens only on initial build. After a HCP it works.

Maybe we need an "isLoaded" state before I add the "loaded" event?

I could not find something like this.

the event is never called.
please see the code below:

Meteor.onStartup = ->
    Tracker.autorun( (computation) ->
        if(Ground.ready())
            Session.set("isLoading", true)
            LocalTags.addListener('loaded', ->
                Session.set("isLoading", false)
                console.log("Added LocalTags Listener")

...

The listener should not be applied in the startup+autorun - should be applied after definition

awesome. thank you.

However, IMHO a

Ground.loaded() and Collection.loaded()

would be a great addition.

I've released 2.0.0-alpha.1 Notes about the new version, migration and what it doesn't do - The issue might be resolved in that version, let me know what you think

@raix Is there any documentation on how to use events and listeners? I'm trying the code above and I'm not getting any signal.

I'd like a way to know: 1) that there is a cache available, 2) that the data is syncing 3) the data synced and is up to date.
Any ideas?

Ground.Collection(Report);
Tracker.autorun( function() {
    Report.addListener('loaded', function(){
          Session.set("isLoading", false)
          console.log("Added Report Listener")
      });
}

What version of ground db are you using?

The latest on Atmosphere, 0.3.15 , Thanks in advance!

you might want to tryout https://github.com/GroundMeteor/db/tree/grounddb-caching-2016 - this will soon be the latest - mind theres breaking behaviour (might get more backwards compatible)

Tak Morten, I didn't know you were working on a rewrite. Can you give an example of using the events, and what events are available. This is very helpful, looking forward to the release!

Hi, it currently seem stable - it's more limited on features that v1 compared to method call resume and offline tab sync - these might be added if needed (I've removed some of the magic and meteor ddp dependencies)

Note theres an example of semi backwards compability in https://github.com/GroundMeteor/db/tree/grounddb-caching-2016#need-a-near-backwards-compatible-solution - this might be added as a separate package if theres a need for it.

I've added documentation regarding events in: https://github.com/GroundMeteor/db/tree/grounddb-caching-2016#more