@frzr/view

0.0.4 • Public • Published

view

FRZR View

installation

// with frzr
npm install frzr

// standalone
npm install @frzr/view

require

// with frzr
var View = require('frzr').View

// standalone
var View = require('@frzr/view')

usage

var view = new View(options)

options

  • init: triggers when View is created
  • template: HTML string to build the template from. Gets parsed and memoized.

Any other parameter will be added as a local attribute

methods

  • $find(query): finds DOM elements inside template
    • You can use $find('$id') to find <div frzr="id"></div> superfast.
  • mount(target): mount to DOM (rest is automatic)
  • mountBefore(target, before): mount to DOM (with insertBefore)
  • addListener(target, eventName, cb): shortcut to addEventListener but listeners get removed when view is destroyed
    • You can also use view.addListener('#id', 'click', onClick) as a shortcut for view.addListener(view.$find('#id'), 'click', onClick)

events

  • add: triggered when View is added
  • remove: triggered when View is removed

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    1
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i @frzr/view

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • frzr