UNPKG

toloframework

Version:

Javascript/HTML/CSS compiler for Firefox OS or nodewebkit apps using modules in the nodejs style.

150 lines (143 loc) 6.4 kB
/********************************************************************** require( 'require' ) ----------------------------------------------------------------------- @example var Path = require("node://path"); // Only in NodeJS/NW.js environment. var Button = require("tfw.button"); **********************************************************************/ var require = function() { var modules = {}; var definitions = {}; var nodejs_require = typeof window.require === 'function' ? window.require : null; var f = function(id, body) { if( id.substr( 0, 7 ) == 'node://' ) { // Calling for a NodeJS module. if( !nodejs_require ) { throw Error( "[require] NodeJS is not available to load module `" + id + "`!" ); } return nodejs_require( id.substr( 7 ) ); } if( typeof body === 'function' ) { definitions[id] = body; return; } var mod; body = definitions[id]; if (typeof body === 'undefined') { var err = new Error("Required module is missing: " + id); console.error(err.stack); throw err; } mod = modules[id]; if (typeof mod === 'undefined') { mod = {exports: {}}; var exports = mod.exports; body(exports, mod); modules[id] = mod.exports; mod = mod.exports; //console.log("Module initialized: " + id); } return mod; }; return f; }(); function addListener(e,l) { if (window.addEventListener) { window.addEventListener(e,l,false); } else { window.attachEvent('on' + e, l); } }; addListener( 'DOMContentLoaded', function() { document.body.parentNode.$data = {}; // Attach controllers. var W = require('x-widget'); W('wdg.label34', 'wdg.label', {"value": "true"}) W('wdg.label35', 'wdg.label', {"value": "My Label"}) W('wdg.label36', 'wdg.label', {"value": "0"}) W('wdg.label37', 'wdg.label', {"value": "Type text..."}) W('wdg.label38', 'wdg.label', {"value": "My Label"}) W('wdg.label39', 'wdg.label', {"value": ""}) W('wdg.label40', 'wdg.label', {"value": "Animal, Bomb, Castel, Deus, Extravaganza, Fabulous, Gangster"}) W('wdg.label41', 'wdg.label', {"value": "true"}) W('wdg.label42', 'wdg.label', {"value": "false"}) W('wdg.label43', 'wdg.label', {"value": "true"}) W('wdg.text44', 'wdg.text', { value: "true", label: "My Label", size: "0", placeholder: "Type text...", type: "My Label", validator: "", list: "Animal, Bomb, Castel, Deus, Extravaganza, Fabulous, Gangster", enabled: "true", wide: "false", visible: "true"}) W('wdg.text45', 'wdg.text', { value: "true", label: "My Label", size: "0", placeholder: "Type text...", type: "My Label", validator: "", list: "Animal, Bomb, Castel, Deus, Extravaganza, Fabulous, Gangster", enabled: "true", wide: "false", visible: "true"}) W('txtValue', 'wdg.text', { label: "value", value: "true", wide: "true"}) W('txtLabel', 'wdg.text', { label: "label", value: "My Label", wide: "true"}) W('txtSize', 'wdg.text', { label: "size", value: "0", wide: "true"}) W('txtPlaceholder', 'wdg.text', { label: "placeholder", value: "Type text...", wide: "true"}) W('txtType', 'wdg.text', { label: "type", value: "", wide: "true", list: "text, button, checkbox, color, date, datetime, email, file, hidden, image, month, password, radio, range, reset, search, submit, tel, time, url, week"}) W('txtValidator', 'wdg.text', { label: "validator", value: "", wide: "true"}) W('txtList', 'wdg.text', { label: "list", value: "Animal, Bomb, Castel, Deus, Extravaganza, Fabulous, Gangster", wide: "true"}) W('chkWide', 'wdg.checkbox', { text: "wide", value: "false", wide: "true"}) W('chkEnabled', 'wdg.checkbox', { text: "enabled", value: "true", wide: "true"}) W('chkVisible', 'wdg.checkbox', { text: "visible", value: "true", wide: "true"}) W.bind('wdg.label34',{"value":{"B":[["txtValue","action"]]}}); W.bind('wdg.label35',{"value":{"B":[["txtLabel","action"]]}}); W.bind('wdg.label36',{"value":{"B":[["txtSize","action"]]}}); W.bind('wdg.label37',{"value":{"B":[["txtPlaceholder","action"]]}}); W.bind('wdg.label38',{"value":{"B":[["txtType","action"]]}}); W.bind('wdg.label39',{"value":{"B":[["txtValidator","action"]]}}); W.bind('wdg.label40',{"value":{"B":[["txtList","action"]]}}); W.bind('wdg.label41',{"value":{"B":[["chkEnabled","action"]]}}); W.bind('wdg.label42',{"value":{"B":[["chkWide","action"]]}}); W.bind('wdg.label43',{"value":{"B":[["chkVisible","action"]]}}); W.bind('wdg.text44',{"value":{"B":[["txtValue","action"]]},"label":{"B":[["txtLabel","action"]]},"size":{"B":[["txtSize","action"]]},"placeholder":{"B":[["txtPlaceholder","action"]]},"type":{"B":[["txtType","action"]]},"validator":{"B":[["txtValidator","action"]]},"list":{"B":[["txtList","action"]]},"enabled":{"B":[["chkEnabled","action"]]},"wide":{"B":[["chkWide","action"]]},"visible":{"B":[["chkVisible","action"]]}}); W.bind('wdg.text45',{"value":{"B":[["txtValue","action"]]},"label":{"B":[["txtLabel","action"]]},"size":{"B":[["txtSize","action"]]},"placeholder":{"B":[["txtPlaceholder","action"]]},"type":{"B":[["txtType","action"]]},"validator":{"B":[["txtValidator","action"]]},"list":{"B":[["txtList","action"]]},"enabled":{"B":[["chkEnabled","action"]]},"wide":{"B":[["chkWide","action"]]},"visible":{"B":[["chkVisible","action"]]}}); } );