[GIS] How to register to event in OpenLayers 3

eventsjavascriptopenlayersopenlayers-2

I have a web application in OpenLayers and I am starting to rewrite it to OpenLayers 3.
In the application I have some features that I need to delete/move/add/edit then to save the changes to the server.

In the previous version I
added a new control, and an event to the control.
These are all the controls in the previous version:

    controls = {
    point: new OpenLayers.Control.DrawFeature(editable,
                        OpenLayers.Handler.Point, { **featureAdded: onCompletAdd** }),
    line: new OpenLayers.Control.DrawFeature(editable,
                        OpenLayers.Handler.Path, { **featureAdded: onCompletAdd** }),
    polygon: new OpenLayers.Control.DrawFeature(editable,
                        OpenLayers.Handler.Polygon, { **featureAdded: onCompletAdd** }),
    regular: new OpenLayers.Control.DrawFeature(editable,
                        OpenLayers.Handler.RegularPolygon,
                        { handlerOptions: { sides: 5} }, { featureAdded: onCompletAdd }),
    select: new OpenLayers.Control.SelectFeature(
                editable,
                {
                    clickout: true, toggle: false,
                    multiple: false, hover: false,
                    box: false,
                    toggleKey: "ctrlKey", // ctrl key removes from selection
                    multipleKey: "shiftKey" // shift key adds to selection

                }
            ),
    modify: new OpenLayers.Control.ModifyFeature(editable, { **onModificationEnd: onCompleteMove** }),
    deletef: new OpenLayers.Control.SelectFeature(editable, {
        clickout: false,
        box: false,
        toggle: false,
        title: "Delete"
    })
};

It's calling the events featureAdded,onModificationEnd etc…
and for deleting I register to the event 'featurehighlighted' like this:

    controls.deletef.events.register("featurehighlighted", this, function (e) {
    editable.removeFeatures([e.feature]);
});

So how can i do it in OpenLayers 3?
I didn't find any helpful examples in the API.

Best Answer

There're two examples that modify features in the documentation. One is

http://ol3js.org/en/master/examples/modify-test.html

and the other is

http://ol3js.org/en/master/examples/modify-features.html