Handler for event afterSave
334928
protected function doAfterSave()
    {
        $handleBefore = method_exists($this, 'beforeRSave');
        $handleAfter = method_exists($this, 'afterRSave');
        $deleteUnsaved = isset($this->deleteUnsaved) ? $this->deleteUnsaved : true;

        foreach ($this->_process_relation as $name => $process) {
            if (!$process) {
                continue;
            }
            $delUnsaved = is_array($deleteUnsaved) ? (isset($deleteUnsaved[$name]) ? $deleteUnsaved[$name] : true) : $deleteUnsaved;
            // delete old related
            /* @var $child ActiveRecord */
            if (isset($this->_old_relations[$name])) {
                foreach ($this->_old_relations[$name] as $child) {
                    $child->delete();
                }
                unset($this->_old_relations[$name]);
            }
            // save new relation
            $relation = $this->getRelation($name);
            $link = $relation->link;
            $children = $this->$name;
            if ($relation->multiple) {
                foreach ($children as $index => $child) {
                    foreach ($link as $from => $to) {
                        $child->$from = $this->$to;
                    }
                    $oke = $handleBefore === false || $this->beforeRSave($child, $index, $name) !== false;
                    $event = new RelationEvent([
                        'child' => $child,
                        'relation' => $name,
                        'index' => $index,
                    ]);
                    $this->trigger(RelationEvent::BEFORE_SAVE, $event);
                    $oke = $oke && $event->isValid;
                    if ($oke) {
                        $child->save(false);
                        if ($handleAfter) {
                            $this->afterRSave($child, $index, $name);
                        }
                        $event = new RelationEvent([
                            'child' => $child,
                            'relation' => $name,
                            'index' => $index,
                        ]);
                        $this->trigger(RelationEvent::AFTER_SAVE, $event);
                    } elseif ($delUnsaved && !$child->getIsNewRecord()) {
                        $child->delete();
                    }
                }
            } else {
                /* @var $children ActiveRecord */
                if ($children !== null) {
                    foreach ($link as $from => $to) {
                        $children->$from = $this->$to;
                    }
                    $oke = $handleBefore === false || $this->beforeRSave($children, null, $name) !== false;
                    $event = new RelationEvent([
                        'child' => $children,
                        'relation' => $name,
                    ]);
                    $this->trigger(RelationEvent::BEFORE_SAVE, $event);
                    $oke = $oke && $event->isValid;
                    if ($oke) {
                        $children->save(false);
                        if ($handleAfter) {
                            $this->afterRSave($children, null, $name);
                        }
                        $event = new RelationEvent([
                            'child' => $children,
                            'relation' => $name,
                        ]);
                        $this->trigger(RelationEvent::AFTER_SAVE, $event);
                    } elseif ($delUnsaved && !$children->getIsNewRecord()) {
                        $child->delete();
                    }
                }
            }
            unset($this->_process_relation[$name], $this->_original_relations[$name]);
        }
    }
1169636
public function handleRequest(): void
	{
		global $save, $restore;

		$request = $this->getRequest();
		if ((!empty($save) || !empty($restore)) && $request->isPost() && check_bitrix_sessid()) {
			if (!empty($restore)) {
				// Restore defaults
				Option::delete(ADMIN_MODULE_NAME);
				CAdminMessage::showMessage([
					'MESSAGE' => Loc::getMessage('REFERENCES_OPTIONS_RESTORED'),
					'TYPE' => 'OK',
				]);
			} else {
				try {
					// Save options
					foreach ($this->options->getFields() as $id => $opt) {
						switch ($opt['type']) {
							case 'checkbox':
								$value = $request->getPost($id) ? true : false;
								break;

							case 'number':
								$value = (int)$request->getPost($id);
								break;

							case 'text':
							default:
								$value = $request->getPost($id);
								break;
						}

						$event = new Event(ADMIN_MODULE_NAME, 'OnBeforeSetOption_' . $id, ['value' => &$value]);
						$event->send();

						$event = new Event(ADMIN_MODULE_NAME, 'OnBeforeSetOption', ['value' => &$value, 'name' => $id]);
						$event->send();

						Option::set(ADMIN_MODULE_NAME, $id, $value);
					}

					$event = new Event(ADMIN_MODULE_NAME, 'OnAfterSaveOptions');
					$event->send();

					CAdminMessage::showMessage([
						'MESSAGE' => Loc::getMessage('REFERENCES_OPTIONS_SAVED'),
						'TYPE' => 'OK',
					]);
				} catch (\Exception $exception) {
					CAdminMessage::showMessage($exception->getMessage());
				}
			}
		}
	}
1117275
public function afterSave($event)
    {
        foreach ($this->relationKey as $from => $to) {
            $this->_relation[$to] = $this->owner[$from];
        }
        $this->_relation->save();
    }
156811
public function UserModel_AfterSave_Handler($Sender) {
      // Confirm we have submitted form values
      $FormPostValues = GetValue('FormPostValues', $Sender->EventArguments);

      if (is_array($FormPostValues)) {
         $UserID = GetValue('UserID', $Sender->EventArguments);
         $AllowedFields = $this->GetProfileFields();
         $Columns = Gdn::SQL()->FetchColumns('User');

         foreach ($FormPostValues as $Name => $Field) {
            // Whitelist
            if (!array_key_exists($Name, $AllowedFields))
               unset($FormPostValues[$Name]);

            // Don't allow duplicates on User table
            if (in_array($Name, $Columns))
               unset($FormPostValues[$Name]);
         }

         // Update UserMeta if any made it thru
         if (count($FormPostValues))
            Gdn::UserModel()->SetMeta($UserID, $FormPostValues, 'Profile.');
      }
   }
369815
protected function afterSave()
    {
        parent::afterSave();

        if ($this->isFieldChanged('date_begin')) {
            PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC);
            PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_DESC);
        }

        if ($this->isFieldChanged('date_end')) {
            PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_END_ASC);
            PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_END_DESC);
        }

        $this->checkFieldChanges('hidden', PromoBlockListStore::instance()->hidden);
        $this->checkFieldChanges('hidden', PromoBlockListStore::instance()->not_hidden);

        $this->checkFieldChanges('active', PromoBlockListStore::instance()->active);
    }
1327737
function handleEvent(eventDetails){

  createEventInMongo(eventDetails);
  sendAlertEmails(eventDetails);

  /// START Event Types
  if (underscore.contains(startHandler.events, eventDetails.eventType)) { startHandler.handler(eventDetails); }

  /// STOP Event Types
  else if (underscore.contains(stopHandler.events, eventDetails.eventType)) { stopHandler.handler(eventDetails); }

  /// DELETE Event Types
  else if (underscore.contains(deleteHandler.events, eventDetails.eventType)) { deleteHandler.handler(eventDetails); }

  /// CRASH Event Types
  else if (underscore.contains(crashHandler.events, eventDetails.eventType)) { crashHandler.handler(eventDetails); }
}
700157
def on_any_event(self, event):
        """"""
        if os.path.isfile(event.src_path):
            self.callback(event.src_path, **self.kwargs)
321848
def _onLeave(self, evt):
        """"""

        evt.Skip()
        FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
893622
function eventHandler(e) {
      if (e.page.path === loader.getPage(pathname).path) {
        emitter.off(`onPostLoadPageResources`, eventHandler)
        clearTimeout(timeoutId)
        window.___history.push(pathname)
      }
    }
826571
public function afterSave()
    {
        foreach ($this->translationsBuffer as $translation) {
            $this->owner->link($this->translationRelationName, $translation);
        }
    }
466877
def OnSave(self, event):
        """"""

        try:
            filetype = event.attr["filetype"]

        except (KeyError, AttributeError):
            filetype = None

        filepath = self.main_window.filepath
        if filepath is None:
            filetype = config["default_save_filetype"]

        if filetype is None:

            f2w = get_filetypes2wildcards(["pys", "pysu", "xls", "all"])
            __filetypes = f2w.keys()

            # Check if the file extension matches any valid save filetype
            for __filetype in __filetypes:
                if splitext(filepath)[-1][1:] == __filetype:
                    filetype = __filetype
                    break

        # If there is no filepath or no filetype is found then jump to save as

        if self.main_window.filepath is None or filetype is None:
            post_command_event(self.main_window,
                               self.main_window.SaveAsMsg)
            return

        # Save the grid

        post_command_event(self.main_window,
                           self.main_window.GridActionSaveMsg,
                           attr={"filepath": self.main_window.filepath,
                                 "filetype": filetype})

        # Update undo stack savepoint
        undo.stack().savepoint()

        # Display file save in status bar

        statustext = self.main_window.filepath.split("/")[-1] + " saved."
        post_command_event(self.main_window,
                           self.main_window.StatusBarMsg,
                           text=statustext)
431341
@Override
	public void handleEvent(String event, Map<ISFSEventParam, Object> params) {
		handleExtendedEvent(event, new SFSEvent(null, params));
	}
934523
async def handler(event):
    """"""
    q1 = event.pattern_match.group(1)
    q2 = urllib.parse.quote(q1)
    await asyncio.wait([
        event.delete(),
        event.respond(DOCS.format(q1, q2), reply_to=event.reply_to_msg_id)
    ])
1103201
function finalizeHandler(p, hInfo) {
    if (!p) return;

    return p
      .catch(storeErrOnce)
      .then(function () {
        if (errored && !hInfo.ensure) return null;
        _hook(self, 'eachAfter', hInfo, params);
      })
      .catch(storeErrOnce);
  }
1074832
public function afterHandle($event)
    {
        parent::afterHandle($event);
        
        // reset form_token
        if ($this->request->getMethod() === 'POST') {
            
            if ($this->errorInfo && !$this->errorInfo['errcode'] && $this->options['csrfTokenEnabled'] && $this->options['csrfTokenAutoReset']) {
                $this->resetCsrfToken();
            }
        }
    }
1320906
function handleEvent(handler, day, modifiers) {
  if (!handler) {
    return undefined;
  }
  return function (e) {
    e.persist();
    handler(day, modifiers, e);
  };
}
1157611
function(_element,_type,_handler,_capture){
        var _result = {};
        // check element
        _element = _e._$get(_element);
        if (!_element){
            return null;
        }
        _e._$id(_element);
        _result.element = _element;
        // check event handler
        if (!_u._$isFunction(_handler)){
            return null;
        }
        _result.handler = _handler;
        // check type
        var _type = _getTypeList(_type);
        if (!_type){
            return null;
        }
        // save info
        _result.type = _type;
        _result.capture = !!_capture;
        return _result;
    }