Git Product home page Git Product logo

frzr's Introduction

FRZR

Cool new javascript view library.

Made with โ™ฅ + ES6.

FRZR logo

Also check out my little open source vanilla js Deck of Cards: https://deck-of-cards.js.org

download

Development (~10 kb uncompressed)

Production (~5 kb uncompressed & minified)

example

performance demonstration

I challenge you to do a similar bench with your favourite framework x ;)

documentation

Not completely there yet. Will add more details here soon..

View

constructor(type, options)

var view = new View('p', {
  class: 'view',
  update: function (data) {
    this.textContent('Item ' + data.id)
  }
})
view.set({
  id: 1
})

View.extend(type, options)

var CustomView = View.extend('p', {
  class: 'custom-view',
  update: function (data) {
    this.textContent('Item ' + data.id)
    this.setStyle({
      color: 'red'
    })
  }
})
var view = new CustomView()
view.set({id: 1})

mount(target)

view.mount(document.body)

mountBefore(target, before)

view.mountBefore(document.body, document.body.firstChild)

unmount()

view.unmount()

destroy()

view.destroy()

set(data)

view.set({
  id: 1,
  title: 'Item 1'
})

setOptions(options)

view.setOptions({
  class: {
    item: false
  },
  attrs: {
    placeholder: 'value'
  },
  style: {
    color: 'red'
  }
})

textContent(text)

view.textContent('Lorem ipsum')

setClass(classes)

view.setClass({
  red: true
})

setStyle(styles)

view.setStyle({
  color: 'red'
})

setAttributes(attrs)

view.setAttributes({
  autofocus: false,
  placeholder: 'Your name'
})

Views

constructor(ChildView, type, options)

var ListView = View.extend('li', {
  update: function (data) {
    this.textContent = data.title
  }
})
var views = new Views(ListView, 'ul', {
  class: 'views'
})
views.reset([{title: 1}, {title: 2}, {title: 3}])

mount(target)

views.mount(document.body)

mountBefore(target, before)

views.mountBefore(document.body, document.firstChild)

unmount()

views.unmount()

reset(data, key)

views.reset([{title: 2}, {title: 3}, {title: 4}], 'title')

frzr's People

Contributors

pakastin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.