-
-
Save anthonyshort/2dbf56c398f320a4db61 to your computer and use it in GitHub Desktop.
ripple 0.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ripple = require('ripple'); | |
var binder = require('binder'); | |
var template = require('./template.html'); | |
// Data-binding engine | |
var bindings = binder(template) | |
.use(someDirective) | |
.use(someFiltersAndShit); | |
var View = ripple() | |
.engine(bindings) | |
.attr('firstName') | |
.attr('lastName'); | |
module.exports = View.extend({ | |
initialize: function(){ | |
console.log('initializing a view!'); | |
}, | |
onClick: function(event){ | |
console.log('clicked!'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ripple = require('ripple'); | |
var binder = require('binder'); | |
var template = require('./template.html'); | |
// Data-binding engine | |
var bindings = binder(template) | |
.use(someDirective) | |
.use(someFiltersAndShit); | |
var View = ripple({ | |
initialize: function(){ | |
console.log('initializing a view!'); | |
}, | |
onClick: function(event){ | |
console.log('clicked!'); | |
} | |
}); | |
View | |
.engine(bindings) | |
.attr('firstName') | |
.attr('lastName'); | |
module.exports = View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ripple from 'ripple'; | |
import binder from 'binder'; | |
import template from './template'; | |
var bindings = binder() | |
.use(someDirective) | |
.use(someFiltersAndShit); | |
var Base = ripple() | |
.engine(bindings(template)) | |
.attr('firstName') | |
.attr('lastName'); | |
exports class View extends Base { | |
constructor() { | |
super(); | |
console.log('initializing a view!'); | |
}, | |
onClick(event) { | |
console.log('clicked!'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ripple = require('ripple'); | |
var virtual = require('virtual'); | |
var template = require('./template'); | |
var View = ripple({ | |
initialize: function(){ | |
console.log('initializing a view!'); | |
}, | |
onClick: function(event){ | |
console.log('clicked!'); | |
} | |
}); | |
View | |
.engine(virtual(template)) | |
.attr('firstName') | |
.attr('lastName'); | |
module.exports = View; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, maybe constructor is the way to go then:
This works a little better since we're really dealing with a template and not the view. Separating those two seems to get rid of the confusion a bit.