YCB ConfigYahoo 配置捆綁文件
YCB Config 提供了一個(gè)簡單的 API 去訪問和配置 Yahoo 配置捆綁文件,并可以無視文件使用格式。它也提供了一個(gè)緩存層來減少 YCB 模塊對(duì)進(jìn)程的調(diào)用。
示例代碼:
// This contextual information is usually obtained from some custom middleware
in your application.
var context = {
'device': 'iphone',
'locale': 'en-US',
'bucket': 'new-feature-x'};
// This requires that the config we're reading has already been added through `addConfig`.
helper.read('homepage', 'weather-widget', context, function (err, config) {
/**
* The `config` object now contains the correct configuration settings for
* our context above. You can use it to render a template correctly for an
* iPhone, with the right localization settings for the US, and with the new
* feature you're bucket testing for.
*/});評(píng)論
圖片
表情
