Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active November 24, 2019 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/1ba5cce62629bf04bfb336daecc2d465 to your computer and use it in GitHub Desktop.
Save conanak99/1ba5cce62629bf04bfb336daecc2d465 to your computer and use it in GitHub Desktop.
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