a-template
Advanced tools
16
index.js
@@ -7,3 +7,3 @@ /** | ||
*/ | ||
import {$} from "zepto-browserify"; | ||
var $ = require("zepto-browserify").$; | ||
var objs = []; | ||
@@ -80,3 +80,3 @@ var eventType = "input click change keydown contextmenu mouseup mousedown mousemove"; | ||
if(id){ | ||
var obj = aTemplate.getObjectById(id); | ||
var obj = getObjectById(id); | ||
obj.e = e; | ||
@@ -90,3 +90,3 @@ if(obj.method && obj.method[action]){ | ||
}); | ||
export default class aTemplate { | ||
class aTemplate { | ||
constructor(opt) { | ||
@@ -103,2 +103,10 @@ objs.push(this); | ||
addTemplate(template,id) { | ||
$("body").append("<script type='text/template' id='"+id+"'>"+template+"</script>"); | ||
if(!this.templates){ | ||
this.templates = []; | ||
} | ||
this.templates.push(id); | ||
} | ||
loadHtml() { | ||
@@ -528,1 +536,3 @@ var templates = this.templates; | ||
} | ||
module.exports = aTemplate; |
{ | ||
"name": "a-template", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"scripts": { | ||
"build": "browserify ./index.js -t [ babelify --presets [ es2015 ] browserify-shim ] --standalone aTemplate --outfile ./lib/a-template.js", | ||
"build:watch": "watchify ./index.js -t [ babelify --presets [ es2015 ] browserify-shim ] --standalone aTemplate --outfile ./lib/a-template.js" | ||
"build": "browserify ./index.js -t [ babelify --presets [ es2015 ] ] --standalone aTemplate --outfile ./lib/a-template.js", | ||
"build:watch": "watchify ./index.js -t [ babelify --presets [ es2015 ] ] --standalone aTemplate --outfile ./lib/a-template.js" | ||
}, | ||
@@ -8,0 +8,0 @@ "main": "./index.js", |
Sorry, the diff of this file is too big to display
180169
0.3%2481
0.4%