From 70a7e6c3c2019346ea8ad5c52feb464efa0531e5 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Thu, 2 Nov 2017 13:31:13 +0530 Subject: Initial Commit ES6 barebone --- src/index.js | 13 +++++++++++++ src/myview.js | 26 ++++++++++++++++++++++++++ src/view.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 src/index.js create mode 100644 src/myview.js create mode 100644 src/view.js (limited to 'src') diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..f29efc1 --- /dev/null +++ b/src/index.js @@ -0,0 +1,13 @@ +import Backbone from 'backbone'; +import TestView from './view'; +import _ from 'underscore'; + +Backbone.history.start(); + +class Index { + constructor() { + new TestView(); + } +} + +new Index(); diff --git a/src/myview.js b/src/myview.js new file mode 100644 index 0000000..026f563 --- /dev/null +++ b/src/myview.js @@ -0,0 +1,26 @@ +import Backbone from 'backbone'; +import * as _ from 'underscore'; +import $ from 'jquery'; +import Mustache from 'mustache'; + + +export default class MyView extends Backbone.View { + constructor() { + super(); + } + + initialize() { + this.el = '#myarea'; + this.$el = $(this.el); + this.template = 'Hello'; + this.render(); + } + + render() { + console.log(this.el) + this.$el.html(Mustache.render(this.template)); + } + + + +} diff --git a/src/view.js b/src/view.js new file mode 100644 index 0000000..399ac03 --- /dev/null +++ b/src/view.js @@ -0,0 +1,28 @@ +import Backbone from 'backbone'; +import * as _ from 'underscore'; +import $ from 'jquery'; +import Mustache from 'mustache'; +import MyView from './myview'; + + +export default class TestView extends Backbone.View { + constructor() { + super(); + } + + initialize() { + this.el = 'li'; + this.$el = $(this.el); + this.template = '
' + this.render(); + } + + render() { + console.log(this.el) + this.$el.html(Mustache.render(this.template)); + new MyView(); + } + + + +} -- cgit v1.2.3