• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Famous/framework: Build expressive user interfaces with consistent code and reus ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Famous/framework

开源软件地址:

https://github.com/Famous/framework

开源编程语言:

JavaScript 96.6%

开源软件介绍:

Famous Framework (alpha)

The Famous Framework is a new JavaScript framework for creating reusable, composable, and interchangeable UI widgets and applications. It balances declarative with imperative and functional with stateful, and it's built on top of the Famous Engine.

IMPORTANT: This project is a developer preview; expect bugs to occur.


Setup & installation

Make sure you have Node.js installed, at least version 0.12.

Start by cloning this repository.

Then, install dependencies with:

$ npm install

Once the install has finished, start up the local dev server:

$ npm run dev -- -e famous-demos:clickable-square

Now surf to localhost:1618/.


Creating a new component

In this project, create a new component directory within lib/core-components called my-name.

Create a subdirectory within that one for your new component called my-component.

In that subdirectory, create the file my-component.js. The result should be like this:

lib/core-components/my-name/my-component/my-component.js

In that file, add the framework boilerplate:

FamousFramework.component('my-name:my-component', {
    /* Your BEST code goes here */
    /* See below for examples */
});

Note how the string my-name:my-component matches the filename my-name/my-component/my-component.js. This matching is required.

If your local dev server is currently running, stop it now. The restart it with:

$ npm run dev -- -e my-name:my-component

Now surf to localhost:1618/?ff=my-name:my-component. (Note the query string in the URL.)

Changes you make to that file should trigger automatic reload.


Examples

Check out lib/core-components/famous-demos and lib/core-components/famous-tests for a bunch of examples that cover many of the main features and techniques. Below is a quick example of what a Famous Framework component looks like.

This code would lives in the file lib/core-components/jane-doe/nifty-demo/nifty-demo.js. (The convention of only lowercase letters and hyphens is important to stick to.)

FamousFramework.component('jane-doe:nifty-demo', {
    behaviors: {
        '#box': {
            'size': [100, 100],
            'style': {
                'background-color': '#40b2e8'
            },
            'rotation-z': function(rotation) {
                return rotation;
            }
        }
    },
    events: {
        '#box': {
            'click': function($state) {
                $state.set('rotation', $state.get('rotation') + 10, {
                    duration: 1000,
                    curve: 'easeOut'
                });
            }
        }
    },
    states: {
        rotation: 0
    },
    tree: `<node id="box"></node>`
});

Documentation

For API docs and guides, see famous.org/framework.


How to make the most of the framework:

1.) Color inside the lines: Although we've taken care to ensure you can break out of our guidelines and syntax when you need to, we think you'll have a better experience if you stick with them. In some cases, this means you'll have to approach familiar problems in a new way.

2.) Remember the microchip: In Famous Framework, every component is a black box. Sharing state between components is not provided for; you must build your app so that the inputs and outputs of each component connect and synchronize in the right way.


License

Copyright (c) 2015 Famous Industries, Inc. MIT license. See LICENSE.txt.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
herozhou/vue-framework-wz: 发布时间:2022-06-06
下一篇:
Gamua/Starling-Framework: The Cross Platform Game Engine发布时间:2022-06-06
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap