npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@a2604882741z/turbine

v1.3.4

Published

Turbine Javascript Framework

Downloads

41

Readme

Turbine Javascript Framework

npm node

This is a SPA project, It's created with corn concept of Vue, It coded by ES6 Syntax and based on MVVM pattern.

Features

  • Mixed Javascript Syntax with HTML code, you can be able to describe the relationship between operational code and UI component.
  • HTML View will automatically update after described data has been changed, so you don't have to care how to let update tags, because this process is in good hand with Turbine.
  • Powerful directive support, all directives as like a hook marked a HTML tag with prefix 't-', multiple default directives such as 't-for' for loop a dom from data, 't-if' for logic estimate, 't-bind' for binding attributes of HTML Tag, 't-on' for binding Events etc, these are effective to build complex logic and make things easier.
  • The compatibility covered IE 8+, Firfox, Chrome, Edge etc.
  • It has only 33KB (after compress).

Getting Started

Installing

You can install Turbine via npm installation

npm install @a2604882741z/turbine --save-dev

Tourist Guide

Import it at the beginning of your porject's entry

import Turbine from "@a2604882741z/turbine";

A basic example

how to initialize a Turbine object:

code:
<turbine id="myFirstTurbineApp"></turbine>
<script>
	Turbine({
    	el: "#myFirstTurbineApp"
    });
</script>

result:
<div id="myFirstTurbineApp"></div>

el is a key to tell Turbine which node shall be used as root target, it supports string or html object.

Render from data:

then we gonna put some data and render it into the HTML:

code:
<turbine id="myFirstTurbineApp">{{message}}</turbine>
<script>
	Turbine({
    	el: "#myFirstTurbineApp",
        data: {
        	message: "hello world"
        }
    });
</script>

result:
<div id="myfirstTurbineApp">hello world</div>

data is an Object to gather the values which are used to create reactive response, The response cause the View update automatically.

Using directive statement:

code:
<turbine id="myFirstTurbineApp">
	<div t-for="(i, index) in array">{{i + ' ' + index}}</div>
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
    data: {
      	array: [1,2,3]
    }
});

result:
<div id="myfirstTurbineApp">
	<div>1 0</div>
	<div>2 1</div>
	<div>3 2</div>
</div>
code:
<turbine id="myFirstTurbineApp">
	<div t-if="showText">this element won't output into the HTML Tree</div>
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
    data: {
      	showText: false
    }
});

result:
<div id="myfirstTurbineApp"></div>
  • Attribute binding statement example:
code:
<turbine id="myFirstTurbineApp">
	<div t-bind:class="className">this tag will have a className as "pink"</div>
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
    data: {
      	className: "pink"
    }
});

result:
<div id="myfirstTurbineApp">
	<div class="pink">this tag will have a className as "pink"</div>
</div>
code:
<turbine id="myFirstTurbineApp">
	<div t-on:click="clickEvent()">this tag is clickable</div>
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
	methods: {
    	clickEvent: () => {
        	alert("The tag has been clicked");
        }
    }
});
code:
<turbine id="myFirstTurbineApp">
	<input type="text" t-model="textValue">
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
    data: {
    	textValue: "this value will be automatically changed when user changes the input value"
    }
});
  • Display statement:
code:
<turbine id="myFirstTurbineApp">
	<div t-show="display">This element will output with a style statement "display: none;"</div>
</turbine>

Turbine({
    el: "#myFirstTurbineApp",
    data: {
    	display: false
    }
});

result:
<div id="myfirstTurbineApp">
	<div style="display: none;">This element will output with a style statement "display: none;"</div>
</div>
// You might want to access some node directly, here is a way to satisfy your wish by using `ref` as an attribute on tag.

<turbine id="myFirstTurbineApp">
	<div ref="aNode">you can assess this node by coding this.$refs.aNode</div>
</turbine>

let app = Turbine({
    el: "#myFirstTurbineApp"
});
console.log(app.$refs.aNode); // print the dom node out

Troubleshooting

If you get into a trouble and want to get help or share how you solved the issue please visit this page.

Contact me

Github: link Email: [email protected]