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

Description
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?