JavaScriptMVC: Difference between revisions
Moved page from wikipedia:en:JavaScriptMVC ([[Edithistory:|history]]) |
m automatic correction by IA |
||
| Line 28: | Line 28: | ||
== History == | == History == | ||
The first release of JavaScriptMVC was published in May 2008. JavaScriptMVC 2.0 became stable in June 2009 and is based directly on jQuery, mainly to keep the code size small and to focus on its unique features. Version 3.0 was released in December 2010. CanJS, JavaScriptMVC's extracted MVC parts, was released in April 2012. In May 2015, JavaScriptMVC was rebranded as DoneJS<ref>{{Cite web |last=DoneJS |first=Bitovi | The first release of JavaScriptMVC was published in May 2008. JavaScriptMVC 2.0 became stable in June 2009 and is based directly on jQuery, mainly to keep the code size small and to focus on its unique features. Version 3.0 was released in December 2010. CanJS, JavaScriptMVC's extracted MVC parts, was released in April 2012. In May 2015, JavaScriptMVC was rebranded as DoneJS<ref>{{Cite web |last=DoneJS |first=Bitovi |title=donejs - donejs |url=https://donejs.com/ |access-date=2023-11-23 |website=donejs.com |language=en}}</ref> with an extended feature set and scope. | ||
== Controller == | == Controller == | ||
| Line 72: | Line 72: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
produces the following | produces the following output: | ||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
<ul> | <ul> | ||
| Line 81: | Line 81: | ||
== Model == | == Model == | ||
'''JavaScriptMVC's''' model and | '''JavaScriptMVC's''' model and its associated plugins provide lots of tools around organizing model data such as validations, associations, lists and more. But the core functionality is centered around service encapsulation, type conversion, and events.<ref>{{Cite web |title=JavaScriptMVC Overview |url=https://gist.github.com/jupiterjs/989117 |access-date=2022-07-15 |website=Gist |language=en}}</ref> The Model class provides basic functionality to organize the application's data layer. | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
$.Model('Todo', { | $.Model('Todo', { | ||
Latest revision as of 01:56, 22 November 2025
This article needs to be updated. In particular: The JavaScriptMVC project has since become DoneJS. (July 2020) |
| Developer(s) | Justin B. Meyer, Brian Moschel |
|---|---|
| Initial release | May 2008 |
| Final release | 3.3
/ July 23, 2013 |
| Written in | JavaScript |
| Engine | |
| Operating system | Cross-platform |
| Replaced by | DoneJS |
| License | MIT License[1] |
| Website | {{URL|example.com|optional display text}} |
Search JavaScriptMVC on Amazon.
JavaScriptMVC was an open-source rich Internet application framework based on jQuery and OpenAjax. It extends those libraries with a model–view–controller architecture and tools for testing and deployment. Because it does not depend on server components, it can be combined with any web-service interface and server-side language like ASP.NET, Java, Perl, PHP, Python, or Ruby.
History
The first release of JavaScriptMVC was published in May 2008. JavaScriptMVC 2.0 became stable in June 2009 and is based directly on jQuery, mainly to keep the code size small and to focus on its unique features. Version 3.0 was released in December 2010. CanJS, JavaScriptMVC's extracted MVC parts, was released in April 2012. In May 2015, JavaScriptMVC was rebranded as DoneJS[2] with an extended feature set and scope.
Controller
A controller is a list of functions that gets called back when the appropriate event happens. The name of the function provides a description of when the function should be called. By naming functions in the correct way, the Controller recognizes them as Actions and hooks them up correctly, for example:
$.Controller('TodosController',{
".todo mouseover": function(el, ev){
el.css("backgroundColor","red")
},
".todo mouseout": function(el, ev){
el.css("backgroundColor","")
},
"#create_todo click" : function(){
this.find("ol").append("New Todo");
}
});
A controller can also handle OpenAjax events, for example:
$.Controller('TodosController',{
"main.test subscribe": function(ev, publisherData){
// TODO: do something
},
"other.event subscribe": function(ev, publisherData){
// TODO: do something
}
});
View
JavaScriptMVC uses EJS templates to render HTML data in controllers and inject them into the DOM. The syntax was inspired by ERuby and is similar to PHP or other server-side template engines.
For example, file "test.ejs" ( data = [ "Hello", "World" ] ):
<ul>
<% for (var i=0, len = data.length; i < len; i++) { %>
<li><%= data[i] %></li>
<% } %>
</ul>
produces the following output:
<ul>
<li>Hello</li>
<li>World</li>
</ul>
Model
JavaScriptMVC's model and its associated plugins provide lots of tools around organizing model data such as validations, associations, lists and more. But the core functionality is centered around service encapsulation, type conversion, and events.[3] The Model class provides basic functionality to organize the application's data layer.
$.Model('Todo', {
findAll: '/todos',
findOne: '/todos/{id}',
create: '/todos',
update: '/todos/{id}',
destroy : '/todos/{id}'
},{});
Tests
JavaScriptMVC also comes with a comprehensive test plug-in that supports classic unit tests for models, as well as functional tests, that are required to deal with event driven architectures. Tests can be run on the command line with Rhino, using Selenium and during development with the integrated test console pop-up window.
References
- ↑ "JavaScriptMVC license". Bitovi. Retrieved 12 December 2012.
- ↑ DoneJS, Bitovi. "donejs - donejs". donejs.com. Retrieved 2023-11-23.
- ↑ "JavaScriptMVC Overview". Gist. Retrieved 2022-07-15.
External links
- Lua error in Module:Official_website at line 90: attempt to index field 'wikibase' (a nil value).
| This Web-software-related article is a stub. You can help EverybodyWiki by expanding it. |
| This computer-programming-related article is a stub. You can help EverybodyWiki by expanding it. |
This article "JavaScriptMVC" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:JavaScriptMVC. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
