css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html>
   <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
   </head>  
   <body>
      <div class="container">

            <div>
                A <a href="https://sam.js.org" target="_blank">SAM pattern</a> rocket launcher example</a>.
            </div>
            
            <hr>
                <div id="app"></div>
                <div id="tracer" style="position: fixed; top: 0px; right: 0px;"></div>            
            <hr>
            
            <div>
                Rocket Launcher idea credit: <a href="http://www.ebpml.org/about" target="_blank">Jean-Jacques Dubray</a>
            </div>
            <div>
                Reference: <a href="https://bitbucket.org/snippets/jdubray/9dgKp/sam-sample" target="_blank">https://bitbucket.org/snippets/jdubray/9dgKp/sam-sample</a>
            </div>
        </div>
      <script type="application/javascript">
        require(["rocket_launcher_example/all"])
      </script>
   </body>
</html>
            
          
!
            
              var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
define("sam_system", ["require", "exports"], function (require, exports) {
    "use strict";
    var Model = (function () {
        function Model() {
        }
        return Model;
    }());
    exports.Model = Model;
    var SAMSystem = (function () {
        function SAMSystem(model, naps) {
            var _this = this;
            this.naps = [];
            this.propose = function (proposal) {
                if (proposal != null) {
                    _this.model.accept(proposal);
                }
                var state = _this.model.representation();
                //iterate naps
                new _NapLoop(_this.naps, state, _this.action).start();
                _this.model.changes = {};
            };
            this.action = function (action) {
                action.action(_this.propose);
            };
            this.model = model;
            naps != null && this.registerNaps(naps);
            this.action = this.action.bind(this);
            this.propose = this.propose.bind(this);
        }
        SAMSystem.prototype.start = function () {
            this.propose(null);
        };
        SAMSystem.prototype.registerNaps = function (naps) {
            this.naps = this.naps.concat(naps);
        };
        return SAMSystem;
    }());
    exports.SAMSystem = SAMSystem;
    var _NapLoop = (function () {
        function _NapLoop(naps, state, systemAction) {
            var _this = this;
            this.finalized = false;
            this.action = function (action) {
                _this.finalized = true;
                _this.systemAction(action);
            };
            this.state = state;
            this.systemAction = systemAction;
            this.naps = naps.slice().reverse();
        }
        _NapLoop.prototype.start = function () {
            if (!this.finalized) {
                this.loop(this.naps.pop());
            }
        };
        _NapLoop.prototype.loop = function (nap) {
            if (!this.finalized) {
                nap(this.state, this.action);
                if (this.naps.length > 0) {
                    this.loop(this.naps.pop());
                }
                else {
                    this.finalize();
                }
            }
            else {
                this.finalize();
            }
        };
        _NapLoop.prototype.finalize = function () {
            this.finalized = true;
            this.naps = null;
            this.state = null;
            this.systemAction = null;
        };
        return _NapLoop;
    }());
});
define("component", ["require", "exports"], function (require, exports) {
    "use strict";
    var Component = (function () {
        function Component() {
            this.children = new Array();
        }
        Component.prototype._receive = function (data) {
            this.receive(data);
            for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
                var childView = _a[_i];
                childView._receive(data);
            }
        };
        Component.prototype.receive = function (data) { };
        Component.prototype.mount = function (mountPoint) {
            var _root = document.createElement('div');
            mountPoint.appendChild(_root);
            return _root;
        };
        Component.prototype.addChild = function (childView, mountPoint) {
            childView.rootComponent = this.rootComponent;
            this.children.push(childView);
            childView.root = this.mount(mountPoint);
            childView.action = this.action;
            childView.init();
        };
        Component.prototype.removeChild = function (childView) {
            childView.root.remove();
            var index = this.children.indexOf(childView);
            this.children.splice(index, 1);
        };
        return Component;
    }());
    exports.Component = Component;
    var ComponentRoot = (function (_super) {
        __extends(ComponentRoot, _super);
        function ComponentRoot(mountPoint, system) {
            var _this = this;
            _super.call(this);
            this.registered = new Array();
            this.nap = function (state, action) {
                _this._receive(state);
            };
            this.action = system.action;
            this.rootComponent = this;
            this.system = system;
            this.system.registerNaps([this.nap]);
            this.root = this.mount(mountPoint);
        }
        ComponentRoot.prototype.init = function () { };
        return ComponentRoot;
    }(Component));
    exports.ComponentRoot = ComponentRoot;
});
define("rocket_launcher_example/all", ["require", "exports", "sam_system", "component"], function (require, exports, sam_system_1, component_1) {
    "use strict";
    /**
     *
     * Available Actions
     *
     * */
    var StartAction = (function () {
        function StartAction() {
        }
        StartAction.prototype.action = function (propose) {
            propose({ start: true });
        };
        return StartAction;
    }());
    var DecrementAction = (function () {
        function DecrementAction() {
        }
        DecrementAction.prototype.action = function (propose) {
            propose({ decrement: true });
        };
        return DecrementAction;
    }());
    var AbortAction = (function () {
        function AbortAction() {
        }
        AbortAction.prototype.action = function (propose) {
            propose({ abort: true });
        };
        return AbortAction;
    }());
    /**
     *
     * Single extensible model
     *
     */
    var RocketModel = (function (_super) {
        __extends(RocketModel, _super);
        function RocketModel(store, changes) {
            if (store === void 0) { store = {}; }
            if (changes === void 0) { changes = {}; }
            _super.call(this);
            this.store = store;
            this.changes = changes;
        }
        RocketModel.prototype.accept = function (proposal) {
            if (this.store.state === "started" || this.store.state == "counting") {
                if (proposal.decrement) {
                    if (this.store.counter > 0) {
                        this.store.counter--;
                        this.store.state = 'counting';
                        if (this.store.counter == 0) {
                            this.store.state = 'launched';
                        }
                    }
                }
            }
            if (proposal.abort) {
                this.store.state = 'aborted';
            }
            if (proposal.start) {
                this.store.state = 'started';
            }
        };
        RocketModel.prototype.representation = function () {
            var state = { state: this.store.state };
            state.counter = this.store.counter;
            if (state.state === 'counting') {
                state.close = this.store.counter <= 3 ? true : false;
                state.even = this.store.counter % 2 === 0 ? true : false;
            }
            return state;
        };
        return RocketModel;
    }(sam_system_1.Model));
    /**
     *
     * VIEW SYSTEM
     *
     */
    var Counter = (function (_super) {
        __extends(Counter, _super);
        function Counter() {
            _super.apply(this, arguments);
        }
        Counter.prototype.init = function () {
            this.root.innerHTML = "\n            <p class=\"status\"></p>\n            <form class=\"action-form\">\n            </form>\n        ";
            this.status = this.root.querySelector('.status');
            this.actionForm = this.root.querySelector('.action-form');
        };
        Counter.prototype.receive = function (state) {
            var _this = this;
            if (state.state === 'ready') {
                this.status.innerHTML = "Counter: " + state.counter;
                this.actionForm.innerHTML = "\n                 <input type=\"submit\" class=\"btn btn-primary\" value=\"Start\">\n            ";
                this.actionForm.onsubmit = function (e) {
                    _this.action(new StartAction());
                    return false;
                };
            }
            if (state.state === 'started') {
                var _this = this;
                setTimeout(function () {
                    _this.action(new DecrementAction());
                }, 1000);
                this.actionForm.innerHTML = "\n                <input type=\"submit\" class=\"btn btn-danger\" value=\"Abort\">\n            ";
                this.actionForm.onsubmit = function (e) {
                    _this.action(new AbortAction());
                    return false;
                };
            }
            if (state.state === 'counting') {
                this.status.innerHTML = "Counter: " + state.counter + " (" + (state.even ? "Even" : "Odd") + ") " + (state.close ? "CLOSE TO LAUNCH!" : "");
                var _this = this;
                setTimeout(function () {
                    _this.action(new DecrementAction());
                }, 1000);
            }
            if (state.state === 'aborted') {
                this.status.innerHTML = "Aborted at Counter: " + state.counter;
                this.actionForm.innerHTML = "";
            }
            if (state.state === 'launched') {
                this.status.innerHTML = "Launched";
                this.actionForm.innerHTML = "";
            }
        };
        return Counter;
    }(component_1.Component));
    function main() {
        /**
         * SAMSYSTEM - VIEWSYSTEM connection
         */
        var system = new sam_system_1.SAMSystem(new RocketModel({
            state: 'ready',
            counter: 10
        }));
        var root = new component_1.ComponentRoot(document.getElementById('app'), system);
        root.addChild(new Counter(), root.root);
        system.start();
    }
    main();
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm9ja2V0X2xhdW5jaGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc2FtX3N5c3RlbS50cyIsIi4uL3RzL2NvbXBvbmVudC50cyIsIi4uL3RzL3JvY2tldF9sYXVuY2hlcl9leGFtcGxlL2FsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0lBa0JBO1FBQUE7UUFPQSxDQUFDO1FBQUQsWUFBQztJQUFELENBQUMsQUFQRCxJQU9DO0lBNkZHLGFBQUssU0E3RlI7SUFJRDtRQUtJLG1CQUFZLEtBQWEsRUFBRSxJQUFhO1lBTDVDLGlCQW1DQztZQWhDRyxTQUFJLEdBQWdCLEVBQUUsQ0FBQTtZQWF0QixZQUFPLEdBQWEsVUFBRSxRQUFjO2dCQUNoQyxFQUFFLENBQUEsQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLENBQUEsQ0FBQztvQkFDbkIsS0FBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUM7Z0JBQzlCLENBQUM7Z0JBRUQsSUFBSSxLQUFLLEdBQUcsS0FBSSxDQUFDLEtB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jb3VudGluZ1wiKXtcclxuICAgICAgICAgICAgaWYocHJvcG9zYWwuZGVjcmVtZW50KXtcclxuICAgICAgICAgICAgICAgIGlmKHRoaXMuc3RvcmUuY291bnRlciA+IDApe1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcmUuY291bnRlci0tXHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yZS5zdGF0ZSA9ICdjb3VudGluZydcclxuICAgICAgICAgICAgICAgICAgICBpZih0aGlzLnN0b3JlLmNvdW50ZXIgPT0gMCl7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcmUuc3RhdGUgPSAnbGF1bmNoZWQnXHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIFxyXG5cclxuICAgICAgICBpZihwcm9wb3NhbC5hYm9ydCl7IHRoaXMuc3RvcmUuc3RhdGUgPSAnYWJvcnRlZCcgfVxyXG5cclxuICAgICAgICBpZihwcm9wb3NhbC5zdGFydCl7IHRoaXMuc3RvcmUuc3RhdGUgPSAnc3RhcnRlZCcgfVxyXG4gICAgfVxyXG5cclxuICAgIHJlcHJlc2VudGF0aW9uKCkgOiBTdGF0ZXtcclxuICAgICAgICBsZXQgc3RhdGUgPSA8U3RhdGU+eyBzdGF0ZTogdGhpcy5zdG9yZS5zdGF0ZSB9XHJcblxyXG4gICAgICAgIHN0YXRlLmNvdW50ZXIgPSB0aGlzLnN0b3JlLmNvdW50ZXJcclxuXHJcbiAgICAgICAgaWYoc3RhdGUuc3RhdGUgPT09ICdjb3VudGluZycpe1xyXG4gICAgICAgICAgICBzdGF0ZS5jbG9zZSA9IHRoaXMuc3RvcmUuY291bnRlciA8PSAzPyB0cnVlIDogZmFsc2U7XHJcbiAgICAgICAgICAgIHN0YXRlLmV2ZW4gPSB0aGlzLnN0b3JlLmNvdW50ZXIgJSAyID09PSA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J0XCI+XHJcbiAgICAgICAgICAgIGBcclxuXHJcbiAgICAgICAgICAgIHRoaXMuYWN0aW9uRm9ybS5vbnN1Ym1pdCA9IChlKSA9PiB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLmFjdGlvbihuZXcgU3RhcnRBY3Rpb24oKSlcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZihzdGF0ZS5zdGF0ZSA9PT0gJ3N0YXJ0ZWQnKXtcclxuICAgICAgICAgICAgdmFyIF90aGlzID0gdGhpcztcclxuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcclxuICAgICAgICAgICAgICAgIF90aGlzLmFjdGlvbihuZXcgRGVjcmVtZW50QWN0aW9uKCkpXHJcbiAgICAgICAgICAgIH0sIDEwMDApO1xyXG4gICAgICAgICAgICB0aGlzLmFjdGlvbkZvcm0uaW5uZXJIVE1MID0gYFxyXG4gICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9XCJzdWJtaXRcIiBjbGFzcz1cImJ0biBidG4tZGFuZ2VyXCIgdmFsdWU9XCJBYm9ydFwiPlxyXG4gICAgICAgICAgICBgXHJcblxyXG4gICAgICAgICAgICB0aGlzLmFjdGlvbkZvcm0ub25zdWJtaXQgPSAoZSkgPT4ge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5hY3Rpb24obmV3IEFib3J0QWN0aW9uKCkpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYoc3RhdGUuc3RhdGUgPT09ICdjb3VudGluZycpe1xyXG4gICAgICAgICAgICB0aGlzLnN0YXR1cy5pbm5lckhUTUwgPSBgQ291bnRlcjogJHtzdGF0ZS5jb3VudGVyfSAoJHtzdGF0ZS5ldmVuPyBcIkV2ZW5cIiA6IFwiT2RkXCJ9KSA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cclxuICAgIFxyXG4gICAgbGV0IHJvb3QgOiBDb21wb25lbnRSb290ID0gbmV3IENvbXBvbmVudFJvb3QoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2FwcCcpLCBzeXN0ZW0pXHJcbiAgICByb290LmFkZENoaWxkKG5ldyBDb3VudGVyKCksIHJvb3Qucm9vdClcclxuICAgIHN5c3RlbS5zdGFydCgpXHJcbiB9XHJcblxyXG4gbWFpbigpXHJcbiJdfQ==
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console