https://github.com/s3rious/kostyl
https://github.com/s3rious/kostyl
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/s3rious/kostyl
- Owner: s3rious
- Created: 2015-09-28T08:41:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-25T15:00:29.000Z (almost 8 years ago)
- Last Synced: 2025-11-21T07:02:54.622Z (7 months ago)
- Language: HTML
- Size: 418 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kostyl
`kostyl` (Russian slang for kludge)
Quick, dirty and simple library for writing components built on top of jQuery and Underscore.
Because you don't always need nothing more.
## What it got?
* No sugar
* No templating (at all)
* Nothing new
* React-like component lifecycle
* Component state as a single point of truth
* State bindings as a simple (and dirty) function
## What it can?
* Mount at DOM node
* Trigger a function on mount
* Trigger a custom function on state change (and do not trigger when nothing changed)
* Trigger a function on unmount
* Get a list of children components
* Get a list of referenced DOM elements
* Bind a jQuery event
* Unbind an event when component is unmount
## Why?
* Single point of truth is a good idea (when it's a plain readable object)
* Lifecycle works well when you need to clean the mess behind...
* ...and it works well when you need to understand how component works
* And it’s nice to have a clear component API which operates the data, not DOM
* Because I can
## Examples
[Hello world](http://jsbin.com/xisidi/52/edit?html,js,output)
[Simple counter](http://jsbin.com/pidare/42/edit?html,js,output)