Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/flag-extend.js

Last active Nov 24, 2019
Embed
What would you like to do?
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
You can’t perform that action at this time.