Giter VIP home page Giter VIP logo

js-ejsf's Introduction

An attempt to learn javascript by building a simplistic framework. A demo can be found from index.html ( which uses demo/ folder ).

Plans exist to convert this to use typescript / es6.

Currently has:

  • XRH Template Loading with lazy cache
  • Template compile for static values
  • Rather simple binding between html nodes and js controller

Usage:

index.html

<!-- element with 'view' attribute will have its content replaced by routed template -->
<div view>this will be replaced</div>

<!-- the path after #/ is used to identify navigation route name -->
<a href="#/defaultPage">default page</a>

<!-- mvc -->
<script type="text/javascript" src="mvc/mvc.js"></script>
<script type="text/javascript" src="mvc/mvc-route-manager.js"></script>
<script type="text/javascript" src="mvc/mvc-template-manager.js"></script>

<script type="text/javascript" src="mvc/mvc-component-manager.js"></script>
<script type="text/javascript" src="mvc/components/mvc-component-click-fn.js"></script>

<!-- app -->
<script type="text/javascript" src="demo/app.js"></script>

app.js

(function(){
	jhmvc.getModule('RouteManager').add(function(model) {
		model.message = "Hello world";
		model.fn = {
			hi: function() { alert(model.message); }
		};
	}, 'defaultPage', 'default.html');

	jhmvc.init();
})();

default.html

<!-- {{message}} will be replaced by controller's model.message -->
Hi? {{message}}<br/>
<span click-fn="hi">Click me for alert</span>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.