Last active
November 24, 2019 07:12
-
-
Save conanak99/1ba5cce62629bf04bfb336daecc2d465 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showUI() { | |
// Dùng hàm isFlagEnable để lấy giá trị flag, thay vì hardcode | |
const SHOW_NEW_UI = isFlagEnable('show-new-ui'); | |
if (SHOW_NEW_UI) { | |
showPagesV2() | |
} else { | |
showPages() // Show UI cũ | |
} | |
} | |
isFlagEnable(flagName) { | |
// Lấy giá trị flag từ config hoặc biến môi trường | |
const flagEnable = Env[flagName] || Config[flagName]; | |
// Lấy giá trị flag từ 1 service nào đó | |
flagEnable = flagService.getFlag(flagName) | |
return flagEnable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment