I want to save the points (lat and lon) of a polygon as its being drawn or at "ondrawend" and get a list of all the points. Not a free style line drawing, just a straight line polygon.
In the function addGraphic (geometry) is there a way to do this
If your map's spatial reference is Web Mercator or Geographic, you can use the geographicGeometry property of the onDrawComplete event. This will return the XY coordinates in lat/long.
console.log(geometry.geographicGeometry.rings);
When creating a triangle you should get 4 points. The 4th point will be a duplicate of the first point. When you digitizing, double-click the 3rd point and the triangle will auto-complete. If you are trying to close the triangle yourself by double-clicking on the 4th point, it will create a 5th point unless you are exactly clicking on the starting point.