All Projects → aooy → aoy

aooy / aoy

Licence: MIT License
Tiny JavaScript MVVM library with Virtual DOM.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to aoy

InplaceEditBoxLib
WPF/MVVM control to implement a textbox on top of other elements like TreeViewItem or ListViewItem (use case: perform in place edit on top of a displayed text item)
Stars: ✭ 28 (-74.77%)
Mutual labels:  mvvm
MGCleanArchitecture
Clean Architecture with RxSwift & MVVM - Templates and Solutions
Stars: ✭ 156 (+40.54%)
Mutual labels:  mvvm
DevStories-app
A community app built using Kotlin, MVVM and Jetpack Libraries.
Stars: ✭ 24 (-78.38%)
Mutual labels:  mvvm
proxy-mvvm
用proxy简单实现一个mvvm
Stars: ✭ 16 (-85.59%)
Mutual labels:  mvvm
QIQO.Business.Client.Solution
WPF, MVVM, XAML, C#, Prism
Stars: ✭ 13 (-88.29%)
Mutual labels:  mvvm
Football-App
⚽ Football App using MVVM, LiveData, RxJava2, DI, Room, Repository Patern
Stars: ✭ 17 (-84.68%)
Mutual labels:  mvvm
bill
Android 记账 App
Stars: ✭ 16 (-85.59%)
Mutual labels:  mvvm
TVToday
iOS TV Shows app with TMDb Api. RxSwift, MVVM, Clean Architecture. Tuist + Swift Package Manager
Stars: ✭ 27 (-75.68%)
Mutual labels:  mvvm
GitHubApplication
GitHubApplication 📱 is an Android application built to demonstrate the use of modern Android development tools - (Kotlin, Coroutines, Hilt, LiveData, View binding, Data Store, Architecture components, MVVM, Room, Retrofit, Navigation).
Stars: ✭ 11 (-90.09%)
Mutual labels:  mvvm
AppsTracker
Windows Application for tracking computer usage. C# + WPF + MVVM
Stars: ✭ 27 (-75.68%)
Mutual labels:  mvvm
moer
一个全新的基于Proxy的MVVM框架
Stars: ✭ 13 (-88.29%)
Mutual labels:  mvvm
ApolloRickAndMorty
just a side project to try out GraphQL and Dagger Hilt with Clean architecture and MVVM
Stars: ✭ 28 (-74.77%)
Mutual labels:  mvvm
GITGET
GitHub의 Contributions를 iOS의 Widget으로 보여주는 App
Stars: ✭ 101 (-9.01%)
Mutual labels:  mvvm
Luna
Tracking the moon phase using SwiftUI and Combine
Stars: ✭ 19 (-82.88%)
Mutual labels:  mvvm
YouTube-Downloader
An easy-to-use, YouTube video downloader, without pesky ads or malware.
Stars: ✭ 22 (-80.18%)
Mutual labels:  mvvm
mvc-tree
🌳 A chronological visualization of the family of MVC patterns.
Stars: ✭ 40 (-63.96%)
Mutual labels:  mvvm
PlayWeather
🔥🔥🔥 Compose、Lce、MVVM、深色模式、横屏、无网弱网适配、Room、Hilt、多语言切换,目前Android最新的库基本全用上了,你想要的都有🔥🔥🔥
Stars: ✭ 120 (+8.11%)
Mutual labels:  mvvm
DeezerClone
This Application using Dagger Hilt, Coroutines, Flow, Jetpack (Room, ViewModel, LiveData),Navigation based on MVVM architecture.
Stars: ✭ 81 (-27.03%)
Mutual labels:  mvvm
DMSkin-Soft-Hide
隐藏软件&游戏的界面&任务栏图标&支持热键
Stars: ✭ 21 (-81.08%)
Mutual labels:  mvvm
EntertainmentApp
Movie Guide App developed in Kotlin based on MVVM architecture using Tmdb Api
Stars: ✭ 21 (-81.08%)
Mutual labels:  mvvm

aoy Build Status Coverage Status NPM version MIT Licence

A tiny JavaScript MVVM library with Virtual DOM. It has only ~600 lines of code.

Introduction

一个轻量级的MVVM框架-aoy

Install

npm:

$ npm install aoy --save

Usage

ES2015

import { init, el } from 'aoy';

//1. init aoy.
const myAoy = init();
conse store = myAoy.store;

//2. add a store to aoy instance.
store.add('firstStore',{txt: 'this is a P'});

//3. create a component.
const myP = aoy.createComponent({
                el: document.body,
                render: function(){
                    return el('p', this.firstStore.txt);
                }
            });
            
//4. component connect to a store, view will be render immediately.
myAoy.connect(myP, 'firstStore');

//5. when u update this component's store, view will be render again.
store.get('firstStore').txt = 'change view';

CommonJS

var myAoy = require('aoy').init();
var el = myAoy.el;

Browser globals

The dist folder contains aoy.js and aoy.min.js.

<script src="path/to/aoy.js"></script>
<script>
var aoy = Aoy.init();
var store = aoy.store;
var el = aoy.el;
</script>

Examples

Api

aoy.init

init function returns a aoy instance.

aoy.el(selectors, props, children])

return a Virtual DOM.

var span = el('span','this is p') // render <span>this is p</span>
var p = el('div',[ span ]) // render <p><span>this is p</span></p>
var div = el('div#mydiv.classA.classB') // render <div id="mydiv" class="classA classB"></div>

aoy.createComponent(descriptor)

descriptor is Object

descriptor.el:

it is a HTMLElement for component's parentNode.

descriptor.render:

render functon returns vnode.

var inputStore = store.get('inputStore');
var myinput = aoy.createComponent({
	inputFn: function(){
		
	},
	render: function(){
		return el('Input', {
                        oninput: this.inputFn,
                        placeholder: this.inputStore.value,
                        type: 'text' 
				});
	}
});

aoy.connect(component[,stores])

when connect function is called, Virtual DOM will be rendered immediately.

var aoy.connect(mycomponent, 'a') // mycomponent denpend on a.
var aoy.connect(mycomponent, ['a', 'b']) // mycomponent denpend on a and b.

store

aoy instance provides a store.

var aoy = Aoy.init();
var store = aoy.store;

store.add([key ,] data)

function add is used to save data. if no key, this data's key is _DEFAULT.

aoy.store.add('a',{b:1}) // a:{b:1}
aoy.store.add({b:1}) // _DEFAULT:{b:1}

store.get(key)

Return to the corresponding store's data

aoy.store.add('a',{b:1})
aoy.store.get('a') // return {b: 1}

sotre.set(newData)

update data.

aoy.store.add('a',{b:1})

aoy.store.get('a').set({a:1, b:2}) //same: aoy.store.get('a') = {a:1, b:2}

aoy.store.get('a') // return {a:1, b:2}

Note

  • support IE 10 and up + all modern browsers.
  • aoy only data-binding one-level key, if data has deep structure, suggest to cooperate immutable-js .

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].