Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i-bem: Add ability to specify onSetMod callback called when specific value changed to another #1072

Closed
dfilatov opened this issue Jun 24, 2015 · 1 comment
Assignees
Labels

Comments

@dfilatov
Copy link
Member

One of possible proposal is to use ~ or ! to declare such callbacks:

bemDom.decl*('block', {
    onSetMod : {
        'm1' : {
            'v1' : function() {
            },

            '~v1' : function() {   // v1 -> *
                // code
            },

            '!v1' : function() {   // v2 -> v3
                // code
            }
        }
    }
});

In the example above ~v1 is an aliases for

onSetMod : {
    'm1' : {
        '*' : function(modName, modVal, prevModVal) {
            if(prevModVal === 'v1') {
                // code
            }
        }
    }
}

!v1 is an aliases for

onSetMod : {
    'm1' : {
        '*' : function(modName, modVal) {
            if(modVal !== 'v1') {
                // code
            }
        }
    }
}
@dfilatov
Copy link
Member Author

cc @veged

veged added a commit that referenced this issue Jul 8, 2015
veged added a commit that referenced this issue Jul 8, 2015
i-bem: Add ability to specify onSetMod callback called when specific value changed to another
@aristov aristov removed the v2 label Aug 6, 2015
@aristov aristov closed this as completed Aug 6, 2015
@veged veged added the JS label Apr 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants