blocket
Node Chotot blocket
Last updated 4 years ago by duythinht .
ISC · Original npm · Tarball · package.json
$ cnpm install blocket 
SYNC missed versions from official npm registry.

Internal Node Blocket Lib @chotot.com

Install

npm install blocket

Usage:

var Bconf = require('blocket').Bconf
var Trans = require('blocket').Trans

Bconf

static #of(connectionInfos)

Create an instance of bconf connection

var bconf = Bconf.of({host: 'localhost', port: 5656})

#load(callback)

Load bconf from server and caching

bconf.load(function(err) {
    if (err) throw "Server error"
})

#isReady()

Check bconf is loaded and caching?

bconf.isReady() // true or false

get(key, region, callback)

Get bconf key

var obj = bconf.load("*.common.campaign", "vietnam", (err, data) => {
  console.log(data)
  /*
  {
      banner: {
        image: 'img/vn_campaign2.jpg',
        template: 'common/campaign_popup.html'
      },
      url: '/khuyến_mãi.htm',
      showon: ['ai'],
      enabled: 1,
      end_date: '01/09/2012',
      start_date: '01/08/2012',
      result_date: '05/09/2012'
  }
  */
})

Trans

Just run a command like a charm

Trans.connect({host: 'localhost', port: 5656}).do('get_user_info').with('account_id', 17).exec((err, data) => {
  if (err) return console.log(err)
  console.log(data)
})

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

2 Versions

  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |