Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template #619

Merged
merged 5 commits into from
Jan 10, 2022
Merged

Conversation

FadySalama
Copy link
Contributor

This pull request updates the template to version v.0.8.x

Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating the template!! Just a minor point below.

p.s. Just a warning: you forgot to sing the commits

if (tdDirectory) {
this.register(tdDirectory);
}
this.listen_to_myEvent(); //used to listen to specific events provided by a library. If you don't have events, simply remove it
this.listenToMyEvent(); // used to listen to specific events provided by a library. If you don't have events, simply remove it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is asynchronous it would be better to have a start method where the thing got produced and exposed. I would refactor it since we are modifying the template!

resolve();
// write something to property
this.myProperty = inputData;
// resolve that write was succesful
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to show emitting observed properties

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing: https://w3c.github.io/wot-scripting-api/#the-emitpropertychange-method . Is going to be added after I've done reviewing: relu91#17

this.add_actions();
this.add_events();
this.thing.expose();
this.addProperties(); // Initialize properties and add their handlers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also propose renaming these methods. They were named like this from the pre 0.7.x times where each affordance was added via methods and not via the produce(). A possible name could be addPropertyHandlers but there is also initialization happening.

this.thing.emitEvent("myEvent") // Emiting an event (may be removed; only for demonstration purposes)
}
//resolve that action was successful
resolve(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't resolve here correspond to the outputData ?

}

private add_actions() {
private addActions() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contrary to my comment about properties, this should be called addActionHandlers

// write something to property
this.myProperty = inputData;
// resolve that write was succesful
resolve(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what the true value does here, as in I am not sure of the behavior

@danielpeintner
Copy link
Member

Note: @FadySalama you also need to sign Eclipse ECA

Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another, neat pick can we use unknown instead of any as the return type of action and property handler? Using any is usually considered a bad practise and I would discourage using it in a template. (To be honest users will need to replace the type anyway, but I think it is good to provide an already well styled code)

@danielpeintner
Copy link
Member

@FadySalama do you plan to update this PR?

Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!!

@danielpeintner
Copy link
Member

@egekorkan please let us know whether your comments were also revolved.

@egekorkan
Copy link
Member

If I am not wrong, none of my comments are fixed @FadySalama ?

@FadySalama
Copy link
Contributor Author

FadySalama commented Dec 22, 2021

If I am not wrong, none of my comments are fixed @FadySalama ?

I am pretty sure I did @egekorkan. Can you read the file again and point out which points weren't changed?

@egekorkan
Copy link
Member

My bad, good to be merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants