How override Event On adding Of Grid Row

I want to do custom logic on deleting or adding row to grid .

I read this but it is not what I am looking for :

I want to make some validation for somthing, if it is false it should not allow the user to add new row

You can validate the values on form refresh event.

frappe.ui.form.on("Doctype", {
  refresh: function(frm) {
    //your validation here

Here is Code snippet from Customize Form. It allows only non-standard fields to be deleted by user.

frappe.ui.form.on("Customize Form Field", {
	before_fields_remove: function(frm, doctype, name) {
		var row = frappe.get_doc(doctype, name);
		if(!(row.is_custom_field || row.__islocal)) {
			msgprint(__("Cannot delete standard field. You can hide it if you want"));
			throw "cannot delete custom field";
	fields_add: function(frm, cdt, cdn) {
		var f = frappe.model.get_doc(cdt, cdn);
		f.is_custom_field = 1;

Note - Not sure about if there is any event which is called before adding row to grid.