Sha256: 8e95a9b876e693bd2723f3c187058a3fd4827374a1806565c944ddd978c5d18d

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports);
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports);
    global.jank = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;
  var interval = null;
  var result = null;

  function initJank() {
    var button = document.getElementById('button');
    button.addEventListener('click', function () {
      if (interval === null) {
        interval = setInterval(jank, 1000 / 60);
        button.textContent = 'STOP JANK';
      } else {
        clearInterval(interval);
        interval = null;
        button.textContent = 'START JANK';
        result.textContent = '';
      }
    });
    result = document.getElementById('result');
  }

  function jank() {
    var number = 0;

    for (var i = 0; i < 10000000; i++) {
      number += Math.random();
    }

    result.textContent = number;
  }

  var _default = initJank;
  _exports.default = _default;
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-js_wrap-three-0.1.5 lib-opal/js_wrap/three/offscreen/jank.js
opal-js_wrap-three-0.1.4 lib-opal/js_wrap/three/offscreen/jank.js
opal-js_wrap-three-0.1.3 lib-opal/js_wrap/three/offscreen/jank.js
opal-js_wrap-three-0.1.2 lib-opal/js_wrap/three/offscreen/jank.js