0.0.1 • Published 7 years ago

rgc-alias v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

rgc-alias

A simple javascript utility for regular component to create an alias.

Install

npm install rgc-alias

Usage

//commonjs
var alias = require('rgc-alias');
//es6
import alias from 'rgc-alias';
//global
var alias = window['rgc-alias'];
//amd
define([
    'rgc-alias'
], function(alias) {
    ...
})

Function

import Regular from 'regularjs';
import alias from 'rgc-alias';

const CustromComponent = Regular.extend({
    
    name: 'custom-component',
    
    config(data) {
    
    }
})

//Component or Components as arguments
//such as alias([Comp1, Comp2...])
alias(CustromComponent);

//then you can get a new Component with your name 
const newComp = CustromComponent.alias('anothe-name');