GithubHelp home page GithubHelp logo

xtapod-coding-challenge's Introduction

starter_repo

Starter repo for getting to know how the Osmosis codebase works

  1. Run ./configure.
  2. Run node osmosis.js.
  3. Navigate to localhost:3005.

Notes

A basic documentation of the Osmosis framework

Table of Contents

  1. Components
    1.1 Base Component
    1.2 Mixing a Component
  2. Binding
    2.1 In a prototype

Components

  • Base Component

    /**
     * Component() is a component to be rendered onto the screen.
     * It is comprised of a `.js`, `.jade`, and `.less` file.
     * 
     * @param {function} bind 
     * @param {Object} args Arguments passed in when the component is mixed
     */
    function Component(bind,args) {
      bind(this);
    }
    
    Component.prototype.exampleFunction = function() {}
    
    module.exports = Component;

  • Mixing a Component

    ParentComponent.js

    function ParentComponent(bind, args) {
      // You must call `bind(this)` before mixing
      bind(this)
    
      fs.mix(this, 'ui/ChildComponent');
    }
    
    module.exports = ParentComponent;

    ParentComponent.jade

    .ui-ParentComponent
      .ui-ChildComponent

    ChildComponent.js

    function ChildComponent(bind, args) {
      bind(this)
    }
    
    module.exports = ChildComponent;

Binding inside foreach

  • In a prototype

    Example.js

    Component.prototype.exampleFunction = function(item) {
      var self = this;
    
      return function() {
        // Use `self` in place of `this` to access component variables
        // `item` references the individual list item itself
      }
    }

    Example.jade

    .ui-Component
      div(data-bind="foreach: items")
        div(data-bind="click: exampleFunction($data)")

xtapod-coding-challenge's People

Contributors

alexmylonas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.