2

cample - npm

 1 year ago
source link: https://www.npmjs.com/package/cample
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

cample

Cample.js - typed javascript web framework for creating site UI.

Added support for Single Page Application (SPA) creation!

Components and Routes

About

Cample.js - typed javascript web framework for creating site UI. This framework is great for creating most of the various sites, due to its extensive functionality.

Feauters

Cample.js provides the following features:

  • Supporting component approach
  • Cycle
  • Some operators like in vanilla js for working with components
  • Animation
  • Routing
  • Supporting SPA
  • Working with data
  • 100% coverage code
  • No dependencies
  • Typed

Installation

Install via NPM:

npm i -D cample 

Installing via npm is currently the default. The framework can work with most modern bundlers.

Getting started

An instance of the Cample class is created, which is the main handler of all technological entities (routes, components, etc.).

JavaScript

const component = new Component("new-component","component"}
            
const newCample = new Cample("#page");
newCample.render(`
    <div> class="content">
        {{component}}
    </div>
`,{
    component
});
<div id="page"></div>

Link article: Getting started.
See Cample.js docs for more details.

Example code

JavaScript

const newCample = new Cample("#page",{
    mode:{
        value:"watch"
    }
});
const component = new Component("new-component", 
`<div class="component">
    {{component_text}}
</div>`,{
    script:[(elements)=>{
      console.log(elements.component);
    },
    {
        start:'afterLoad',
        elements:[
            {component:".component"}
        ]
    }],
    attributes:{
        id:"id"
    },
    data:{
        component_text:"Component"
    },
    style:""
});
const routelinkComponent = new Component("routelink-component","routelink"); 
const routelink1 = new RouteLink("new-routelink", "routelink-component", "/component"); 

const newRoute = new Route("#page",
    "<div class='content' >
        {{component}}
    </div>"),
    {component},
    "/component"
);    

newCample.render("{{routelink1}}",{routelink1})
newCample.renderRoutes({newRoute});
<div id="page"></div>

Repository

Repository

Changelog

Changelog

License

Licensed under MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK