-
Notifications
You must be signed in to change notification settings - Fork 2
Offline mode usage
Junaid Atari edited this page Apr 9, 2016
·
1 revision
// Uncomment to set mode as offline
// defined('YII2CDN_OFFLINE') or define('YII2CDN_OFFLINE', true);
// ================== Offline ======================
/** Example 1: (offline) */
if ( !\yii2cdn\Cdn::isOnline() ) {
// some logic goes here
}
/** Example 2: (offline event) */
\Yii::$app->cdn->whenOffline (function ($cdn) {
/** @var \yii2cdn\Cdn $cdn */
// some logic goes here
});
// ================== Online ======================
/** Example 1: (online) */
if ( \yii2cdn\Cdn::isOnline() ) {
// some logic goes here
}
/** Example 2: (online event) */
\Yii::$app->cdn->whenOnline (function ($cdn) {
/** @var \yii2cdn\Cdn $cdn */
// some logic goes here
});Copyright (c) 2016 Junaid Atari and it's contributes.