Esempio n. 1
0
var ui = require('ui');
var app = ui.run({
    url: '/',
    server: {
        basePath: 'app'
    },
    window: {
        title: 'Editor',
        width: 600,
        height: 400,
        left: '10%',
        top: '10%',
        frame: true,
        resizable: true,
        topmost: false,
        opacity: 1,
        state: ui.Window.STATE_NORMAL,
        menu: []
    }
});
app.server.backend = function (req, res) {
    var qs = require('querystring');
    if (req.method == 'POST') {
        var body = '';
        req.on('data', function (data) {
            body += data;
        });
        req.on('end', function () {
            var post = qs.parse(body);
            if (req.url.lastIndexOf('/exec', 0) === 0) {
                console.log('EXEC\n' + post.code);
Esempio n. 2
0
var app = ui.run({
    url: '/',
    server: {
        basePath: 'app'
    },
    support: {
        "msie": "6.0.2",
        "webkit": "533.16",
        "webkitgtk": "2.3"
    },
    window: {
        title: 'Hello World',
        width: 600,
        height: 400,
        left: '10%',
        top: '10%',
        frame: true,
        resizable: true,
        topmost: false,
        opacity: 1,
        state: ui.Window.STATE_NORMAL,
        menu: [{
            title: '&Edit'
        }, {
            title: '&My menu',
            items: [
                { title: '&Hello' },
                { title: '&World', items: [{ title: 'w1' }, { title: 'w&2' }] },
                { type: ui.Window.MENU_TYPE_SEPARATOR },
                { title: 'E&xit', callback: function () { console.log('Menu exit'); process.exit(0); } }]
        }, {
            title: '&Help',
            items: [{ title: 'Some help...' }]
        }]
    }
});