How to use elm - 10 common examples

To help you get started, we’ve selected a few elm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kakaroto / e17 / PROTO / elev8 / data / javascript / clock.js View on Github external
var elm = require('elm')

var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };

var EDIT_HOUR = 2; //constants required by elementary - why should I expose this?
var EDIT_MINUTE = 8; // constants required by elementary - why should I expose this?
var EDIT_SECOND = 32; // constants required by elementary - why should I expose this?

var w = elm.Window({
    title: "Clock Demo",
    width: 320,
    height: 480,
    align: FILL_BOTH,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
        }),
        the_box: elm.Box({
            weight: EXPAND_BOTH,
            resize: true,
            elements: {
                the_clock: elm.Clock({
                    show_am_pm: 1,
                    show_seconds: 1,
                    hour: 23,
                    minute: 45,
                    second: 34,
                    edit: true,
                    digit_edit: EDIT_HOUR | EDIT_MINUTE | EDIT_SECOND,
github kakaroto / e17 / PROTO / elev8 / data / javascript / actionslider.js View on Github external
var elm = require('elm');

var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };

function select_cb(widget, label) {
    print(label);
    if (!label) // undefined
        widget.label = "Go";
    else
        widget.label = label;
}

var w = elm.Window({
    title: "ActionSlider example",
    width: 320,
    height: 480,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            resize: true,
        }),
        the_box: elm.Box({
            weight: { x: 1.0, y: 0.0 },
            resize: true,
            elements: {
                snooze_right: elm.ActionSlider({
                    weight: { x: 1.0, y: 0.0 },
                    align: { x: -1.0, y: 0.0 },
                    labels: { left: "Snooze", right: "Stop" },
github tasn / elementary / src / examples / slider_example.js View on Github external
efl = require('efl');
elm = require('elm');

win = new elm.Elm.WinStandard(null);
win.setTitle("Slider Example");
win.setAutohide(true);

bx = new elm.Elm.Box(win);
//bx.setHorizontal(true);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);

sl = new elm.Elm.Slider(win);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);

/* with icon, end and label */
github tasn / elementary / src / examples / slider_example.js View on Github external
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);

/* with unit label and min - max */
sl = new elm.Elm.Slider(win);
sl.setUnitFormat("%1.0f units");
sl.setMinMax(0, 100);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);

/* with indicator label and inverted */
sl = new elm.Elm.Slider(win);
sl.setIndicatorFormat("%1.2f");
sl.setInverted(true);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);

/* vertical with indicator format func */
sl = new elm.Elm.Slider(win);
sl.setHorizontal(false);
//indicator_format = function()
//                  {
//                      indicator = new char[32];
//                      nprintf(indicator, 32, "%1.2f u", val);
//                      return indicator;
//                  }
github jaredpalmer / razzle / packages / razzle-plugin-elm / index.js View on Github external
pathToMake: require('elm/platform').executablePaths['elm-make'],
            forceWatch: true,
          },
        },
      ],
    });
  } else {
    // Production
    config.module.rules.push({
      test: /\.elm$/,
      exclude: [/elm-stuff/, /node_modules/],
      use: [
        {
          loader: require.resolve('elm-webpack-loader'),
          options: {
            pathToMake: require('elm/platform').executablePaths['elm-make'],
          },
        },
      ],
    });
  }

  return config;
};
github jaredpalmer / razzle-react-vue-elm-php-lol / 04-react-vue-elm-php / razzle.config.js View on Github external
config.resolve.extensions.push('.elm');

    if (dev) {
      config.module.rules.push({
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          // {
          //   loader: 'elm-hot-loader',
          // },
          {
            loader: 'elm-webpack-loader',
            options: {
              verbose: true,
              warn: true,
              pathToMake: require('elm/platform').executablePaths[
                'elm-make'
              ],
              forceWatch: true,
            },
          },
        ],
      });
    } else {
      // Production
      config.module.rules.push({
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          {
            loader: 'elm-webpack-loader',
            options: {
github jaredpalmer / razzle / examples / with-elm / razzle.config.js View on Github external
pathToMake: require('elm/platform').executablePaths['elm-make'],
              forceWatch: true,
            },
          },
        ],
      });
    } else {
      // Production
      appConfig.module.rules.push({
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          {
            loader: 'elm-webpack-loader',
            options: {
              pathToMake: require('elm/platform').executablePaths['elm-make'],
            },
          },
        ],
      });
    }

    return appConfig;
  },
};
github shr-project / enlightenment / PROTO / easyui / eui.js View on Github external
if (this.didChangeURI)
          this.didChangeURI(uri);
      }.bind(this),

      on_link_hover_in: function(uri, title) {
        this.link_hover_notify.visible = true;
        this.link_hover_notify.content.text = uri;
      }.bind(this),

      on_link_hover_out: function() {
        this.link_hover_notify.visible = false;
      }.bind(this)
    });

    this.viewDescriptor = elm.Box({
      expand: 'both',
      fill: 'both',
      horizontal: false,
      elements: {
        web: web,
        progress: progress, /* FIXME get this out of the box */
        link_hover_notify: link_hover_notify /* FIXME get this out of the box */
      },
    });
  },
github kakaroto / e17 / PROTO / elev8 / data / javascript / anim.js View on Github external
}

function bubble(n) {
    return sprite(n, 'bb');
}

function shadow(n) {
    return sprite(n, 'sh');
}

var win = elm.realise(elm.Window({
    label: "Animation demo",
    width: 480,
    height: 800,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            image: elm.datadir + "data/images/rock_01.jpg",
            resize: true
        }),
        shadow1: shadow(0),
        shadow2: shadow(1),
        shadow3: shadow(2),
        bubble1: bubble(0),
        bubble2: bubble(1),
        bubble3: bubble(2)
    },
    on_keydown: function () {
        print(this.label);
        elm.exit();
    }
}));
github tasn / elementary / src / examples / radio_example_01.js View on Github external
elm = require('elm');

_cb = function(obj){
   console.log(obj.getText("elm.text"), "state value:", obj.getStateValue());
}

win = new elm.Elm.WinStandard(null);
win.setTitle("Radio");
win.setAutohide(true);

bx = new elm.Elm.Box(win);
bx.setHorizontal(true);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);

radio_g = new elm.Elm.Radio(win);
radio_g.setText("elm.text", "Radio 1");
radio_g.setStateValue(1);
radio_g.setValue(1);
ic = new elm.Elm.Icon(win);
ic.setStandard("home");
radio_g.contentSet("icon", ic);