Skip to content

Instantly share code, notes, and snippets.

@floatdrop
Last active August 29, 2015 14:04
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 floatdrop/89088fe512f46fb92949 to your computer and use it in GitHub Desktop.
Save floatdrop/89088fe512f46fb92949 to your computer and use it in GitHub Desktop.
BH IS AWESOME
var bh = new (require('bh').BH)();
bh.match('button', function(ctx) {
ctx.mix({block: 'i-global'});
});
bh.match('button', function(ctx) {
return [
'2',
ctx.json(),
ctx.json(),
ctx.json(),
'2'
];
});
bh.match('button', function(ctx) {
return [
'1',
ctx.json(),
ctx.json(),
ctx.json(),
'1'
];
});
bh.apply({block: 'button'}); // What it will be?
@iamstarkov
Copy link

до bh.apply({block: 'button'}); получилось так:

[
    '2',
    [
        '1',
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        '1'
    ],
    [
        '1',
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        '1'
    ],
    [
        '1',
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        { block: 'button', mix: [{block: 'i-global'}] },
        '1'
    ],
    '2'
]

@iamstarkov
Copy link

Есть ещё вероятность этого:

[
    '1',
    { block: 'button', mix: [{block: 'i-global'}] },
    { block: 'button', mix: [{block: 'i-global'}] },
    { block: 'button', mix: [{block: 'i-global'}] },
    '1'
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment