Code Monkey home page Code Monkey logo

xin's Introduction

Xin logo

Project Status: Abandoned - Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.

A Framework. Not sure where this is headed just yet.

Check out the docs/api.md for more infos.

THIS IS IN ALPHA AND UNSTABLE BUT FEEL FREE TO FIND ISSUES.

Features:

  • Events
  • modules
  • Databinding
  • Templating

Usage

XIN provides two global functions as well as a global 'XIN' object.

Events

To handle events XIN provides emit() and subscribe(). The philosophy is that emit() will broadcast something to a channel. You can hand emit() as many arguments as you want. subscribe() can be used to listen on a specific channel. Just hand it a callback. subscribe() also returns an object which you can use to listen to only specific events. Events are specified by the second argument to an emit() call.

//Subscribe to all messages on the 'test' channel.
subscribe('test', function(msg){
    console.log(msg);
});

//Subscribe only to the 'deep' events on the 'test' channel.
subscribe('test').on('deep', function(msg) {
    console.log(`deepEvent: ${msg}`);
})

//This will only be processed by the first listener.
emit('test', 'Hallo Test');

//This will be processed by both bot differently.
emit('test', 'deep', 'Deep event');

Modules

XIN supports the use of AMD modules which means that you define modules.
Modules are identified by their path. So if you have a file at /modules/module.js it's identifier would be modules/module.

define(['dependencies'], function(dep) {
    return module;
});

To define a module you need to call define() with a least an array and a function. All strings in the array will be loaded as dependencies and handed to the function. Whatever gets returned by the function will be handed to modules depending on it.

Requires

You can also require defined module.

require('some/module', function(mod) {

});

More Features

For convenience XIN also provides some more features which are optional but currently deployed with XIN. Check out their docs:

xin's People

Contributors

hoverbaum avatar

Watchers

James Cloos avatar  avatar  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.