ngdoc: How to document exceptions and events of the method? - events

I'm currently writing docs for an AngularJS module. Is there a proper way in the ngdoc to document an exceptions and an events which are thrown by a module's method?
UPD:
In the AngularJS contributing guidelines in the "Applying Code Standards" section is said that ngdoc is just an extended version of the jsdoc format. Does it mean that I could use #fires and #throws syntax to do what I need?

Take a look at https://github.com/angular/angular.js/wiki/Writing-AngularJS-Documentation.
There it is described that an event is declared as
#ngdoc event
You can put different informations to explain in detail what the event does or when it gets fired or something.
And ngdoc is a customized version of jsdoc, so you could use jsdoc-Tags as well but there are not angular specific!

Related

Avalonia + ReactiveUI - pharmacist for Events() generation

I'm trying to get my head around Avalonia in general, and the Reactive UI integration in particular. From googling around, I understand that Avalonia pulled away the Avalonia support in ReactiveUI, and tries to integrate ReactiveUI into Avalonia itself, to support a sometimes unstable Avalonia API.
I'm implementing a flow where a double tap on a DataGrid row should open a details windows, which I can do by adding a handler for the DoubleTapped event in the code behind. However, I was wondering if I could do this in a Reactive UI way, in a WhenActivated() implementation, by observing the DoubleTapped event.
In the ReactiveUI documentation, I see that there is a Pharmacist integration, which generates the observables for these events. However, when I fetch a reference to the DataGrid in the code behind, and try to hook into the DoubleTapped via
myDataGrid.Events(). ..., I don't get to see any events. Does this imply that there's no such support in Avalonia at this time?
Finally, while I'm at it, if I forget about the Reactive UI support, and use a straight-forward event handler, I need to do some stuff to detect whether it was a row that was double tapped, or something else (such as the header). I have to do this, because there's no EventSetter implementation in Avalonia as I understand it.
Somebody who knows if Avalonia will support this in the future?
Edit: in the end I used ReactiveUI somewhat similar to
TreeView.GetObservable(DoubleTappedEvent)
.Subscribe(async x =>
{
var selectedItem = TreeView.SelectedItem;
if (selectedItem is TreeNodeViewModel treeNodeViewModel)
{
await ViewModel!.ActivateResource(treeNodeViewModel);
}
}).DisposeWith(d);
An attached behaviour can also help to bind events to perform logic. There is a sample that looks like it could work provided the DoubleTappedEvent is being fired.
Avalonia Docs - Creating and binding Attached Properties
The dev tools should help show the event your are looking for tunnel and bubble though the DataGrid?
Pharmacist does not support Avalonia. They are working on ReactiveMarbles.ObservableEvents, which as of right now, doesn't work on generic classes, but they're working on fixing it.

How to use react hooks in effective way?

Currently I am learning react. can anyone tell me what is the main application usage of react hooks and how can we take more advantage of using hooks with react.?
Basically, before if a component had state or needed to utilize a lifecycle method, we had to use a class, which requires a bunch of extra code.
Now that is not the case. With hooks, instead of ever having to use a class, we could just always use a function.
Tyler McGinnis wrote good blog post about it here
https://tylermcginnis.com/why-react-hooks/

Validation and ComplexTypes

I have read BreezeJS documention about validation and ComplexTypes. To my knowledge, there should be no reason for that scenario to work.
We use breeze.directives.js. BreezeJS version is 1.4.14. In our application, Person-entity has property PhoneNumber which is ComplexType. Person-entity is binded to a view in AngularJS app. For validation we used the example from Code Camper SPA. Person-entity gets validated and zValidate works as expected. To our surprise PhoneNumber-complextype gets validated too , but validation errors dont show up. So it seems there's problem with zValidation and ComplexTypes.
Anyone know if it should work ? Or are we just missing something?
Note: DocCode or any other sample didn't include this scenario implemented.
zValidate was not written to support ComplexTypes. zValidate is part proof-of-concept and part invitation to the community to contribute. It demonstrates one way to expose Breeze validation to the UI, declaratively, with an Angular directive. We invite you to fork it and offer improvements or alternatives. We're eager to tell the world about your work :-)

how to display all the mothods called in the codeigniter profiler

is there any way to display all the methods called in the codeigniter profiler.
Also like to display which method calls which method and which method trigger the query
Unfortunately, your question is not very clear to me. I am not really sure of what you want to do.
there is a PHP command available in later versions called debug-backtrace.
http://php.net/manual/en/function.debug-backtrace.php
this gives you the stack trace of all commands executed to get to a particular method.
The codeigniter profiler is a system library. If there is a feature you really need it is possible to extend the profiler class to have the functionality you require. the CI manual explains how to do this in the section about 'Extending Native Libraries'

Kendo UI Grid/DataSource - Global Error Handling?

I've currently inherited an application which has numerous Kendo grids (and other controls) throughout, and I'm trying to fix an error which keeps cropping up now and again - specifically when the user is no longer authenticated.
I know what the solution is for a single instance of the control - return a flag to indicate authentication failed, and then detect this in the error handler and perform the authentication.
The problem is am I really going to have to handle this for every instance of a Kendo control I have? Is there not a global error handler I can hook into? Either for the data source itself (as I know this is used for all Kendo control data loading), or for the Grid specificially. I don't mind either way - just which one is a hook.
This would be a more straighforward short term solution than refactoring everything to specific error handlers, etc.
I assume you can attach a global error handler to $.ajax, which is used by the DataSource, you can check how to do it here:
http://api.jquery.com/category/ajax/global-ajax-event-handlers/
Or, you can take advanttage of that the configuration that is done in the DataSource is passed directly to the $.ajax:
http://docs.kendoui.com/api/framework/datasource#configuration-transport.read-ObjectStringFunction
For reference, someone from Telerik has provided a solution using just the DataSource. I haven't tested it, but I prefer the accepted answer above as it hooked into all Ajax on the site - not just ones that utilise the Kendo DataSource.
http://www.kendoui.com/forums/mvc/grid/global-error-handler-for-numerous-grids.aspx

Resources