• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/framecache.php
  • Класс: BitrixMainFrameCache
  • Вызов: FrameCache::setEnable
static function setEnable($isEnable = true)
{
	if ($isEnable && !self::$isEnable)
	{
		self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", Array(__CLASS__, "OnBeforeEndBufferContent"));
		self::$onHandleKey = AddEventHandler("main", "OnEndBufferContent", Array(__CLASS__, "OnEndBufferContent"));
		self::$isEnable = true;

		CJSCore::init(Array("fc"), false);

		$actionType = BitrixMainContext::getCurrent()->getServer()->get("HTTP_BX_ACTION_TYPE");
		if ($actionType == "get_dynamic")//Is it the background request?
			self::$isBackgroundRequest = true;
	}
	elseif (!$isEnable && self::$isEnable)
	{
		if (self::$onBeforeHandleKey >= 0)
			RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey);
		if (self::$onBeforeHandleKey >= 0)
			RemoveEventHandler("main", "OnEndBufferContent", self::$onHandleKey);

		self::$isEnable = false;
	}
}