Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Endpoints #48

@gabrielschulhof

Description

@gabrielschulhof

We cannot specify an endpoint when calling resource.on( "update" ), just as we cannot specify a query flag. We can only specify those if we initiate observation via client.retrieve( destination, query, listener ). Even there it's pretty awkward because giving a query string for which no observation has yet been initiated results in the creation of a new resource. That is,

client.on( "resourcefound", (resource) => {
  const foundResource = resource;
  function resourceValueChanged( resource ) {
    // Here, resource !== foundResource
  }
  client
    .retrieve( foundResource, { scale: "fahrenheit" }, resourceValueChanged )
    .catch((error) => {console.log(error); process.exit(1);})
});

Perhaps we should rename the ClientResource to ResourceView, because that would make it clear that one can have multiple views of a real resource. Then, each ResourceView would have a fixed endpoint and a fixed query.

@zolkis what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions