Examples using JX.View
Summary: Provide a dirt-simple working example of client-side templating and reactive programming. Test Plan: Load the examples Reviewers: epriestley, mroch, tomo Reviewed By: epriestley CC: ide, schrockn, aran, rzadorozny, epriestley Differential Revision: 908
This commit is contained in:
35
webroot/rsrc/js/application/uiexample/ReactorInputExample.js
Normal file
35
webroot/rsrc/js/application/uiexample/ReactorInputExample.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @provides phabricator-uiexample-reactor-input
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
* javelin-view-html
|
||||
* javelin-view-interpreter
|
||||
* javelin-view-renderer
|
||||
*/
|
||||
|
||||
JX.install('ReactorInputExample', {
|
||||
extend: 'View',
|
||||
members: {
|
||||
render: function(rendered_children) {
|
||||
var html = JX.HTMLView.registerToInterpreter(new JX.ViewInterpreter());
|
||||
|
||||
var raw_input = JX.ViewRenderer.render(
|
||||
html.input({ value: this.getAttr('init') })
|
||||
);
|
||||
var input = JX.RDOM.input(raw_input);
|
||||
|
||||
return JX.ViewRenderer.render(
|
||||
html.div(
|
||||
raw_input,
|
||||
html.br(),
|
||||
html.span(JX.RDOM.$DT(input)),
|
||||
html.br(),
|
||||
html.span(JX.RDOM.$DT(input.calm(500)))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user