Giter VIP home page Giter VIP logo

Comments (14)

cgarciae avatar cgarciae commented on August 12, 2024

Id suggest this for the moment, it's a little naive because I know some things will be implemented as Futures, but here is the main idea:

Server

Cargo posts = new Cargo("posts", **conf info**);
Cargo users = new Cargo("users", **conf info**);

posts.publish ((Map request, User|Sender sender) 
{
    if (sender.is (/*some filtering here*/))
        return posts.find(request).filter (/*send a subset of the data*/).
    ...
})

//Maybe also like this

@Publish ('posts')
filterClientPosts (Map request, User|Sender sender)
{
    if (sender.is (/*some filtering here*/))
        return posts.find(request).filter (/*send a subset of the data*/).
    ...
}

Client

ClientCargo posts = new ClientCargo("posts", {topic: "DB API"}); //Send with request
ClientCargo users = new ClientCargo("users"); //All users


posts.onChange (...);
posts.onError(...);

Client stuff should try to register with Angular so that any changes also update the angular templates.

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

That is a great first start. I guess we need to come up with a use case, for example a realtime blog, redit, ... so we can build this example with the new db client api! Probably I need to twist the proposal of you a bit, but it is already a great starting point!

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

Yeah, make the proposal realistic, I am just giving ideas. Meteor's classic examples include: a real time poll, chat, simple social network, Google map with real time gps position of events. I guess the poll is the easiest, you just voted for something in list, each item has a counter, set the getter and setter an angular model to interact with the client-side DB... magic :)

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

I crearted an angular force example application in this github repo.
https://github.com/jorishermans/angular-force-example

It is a start ;-)

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

Could you explain to me this peace of code?

 // Construct page
    fs.server.on("/", (req, model) {
       return "angularforce";
    });

It looks like a basic REST request serving a page, and you don't use sender.send. What is going on here?

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

Yes, this is to handle a page, under the hood it is using ForceMVC it return a viewname, in our case "angularforce" page, I prefer users to use this then using starPage: in the constructor ForceServer.
But you are right it is to confusing.

I am a beginner with angular.dart so if you can improve my angular code, that would be nice!

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

I also like this API better to serve the start page, but how do you tell when you are using MVC to serve stuff or normal WebSocket messaging?

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

I am also new to angular and Dart in general. I'll run your example as soon as I have the time.

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

forceServer.server.on(... // HTTP Requests => will become forceServer.server.use(...
forceServer.on(... // WebSocket messaging

But we need to take this discussion out of this conversation. I added some cargo functionality to the example. So from that point we can look at how we can simplify all of the functionality into a better and simpler api.

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

Can you point me to the cargo part in the example? I just checked but I don't see it.

Is Cargo already running on the client?!?!? If you give me some basic info on how to use it I can start making suggestions.

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

No cargo is for the moment only on the server! I just did a commit! I think we need to work in steps ;-)

from dart-force.

cgarciae avatar cgarciae commented on August 12, 2024

Ok. I'll check.

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

You can view and look at the implementation of the experimental branch of dart force here.

https://github.com/jorishermans/aproducthuntdart

It is a product hunt example that makes it possible to add and update the records.
Would be great if we could get some feedback on this!

from dart-force.

jorishermans avatar jorishermans commented on August 12, 2024

Version 0.6.0 is been released with the clientside db api, you can look at this video to see more info about clientside DB api https://www.youtube.com/watch?v=MtrZLLzPT74

or look at our examples

https://github.com/ForceExamples/aproducthuntdart

or a simpler version of it

https://github.com/ForceExamples/asimplehuntdart

from dart-force.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.