Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

compo-lazy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compo-lazy

MaskJS lazy render component (Atma.js)

latest
npmnpm
Version
0.8.8
Version published
Maintainers
1
Created
Source

Lazy Component

Build Status Bower version

Lazy { /*Template*/ }

Sub-nodes of the component won't be rendered until it is required. It will be instead only one Node Comment added to the DOM, which is the placeholder for the future nodes.

API

  • resolveLazy(?model) #

    • model: (optinal) When model is undefined, then the model object is taken, which was used during the first (initial) render process.

    Render the template to the document fragment, and then replace the placeholder with the nodes.

Inheritance

mask.define('MyComponent', mask.Compo('Lazy', {
	template: `button x-signal= 'click: message' > 'Greet'`,
	constructor () {
		setTimeout(() => this.resolveLazy(), 100);
	},
	slots: {
		message () {
			alert(this.model.name)
		}
	}
}));

$(body).appendMask('MyComponent', { name: 'Smith' });
define MyComponent extends Lazy {

	h4 > 'Hello'
}

As Self Component

Lazy #foo {
	h4 > 'hello'
}
app.find('#foo').resolveLazy();

onRenderStart and onRenderEnd are called after the component was resolved

Examples

# install atma toolkit
npm install atma
# run server
atma server

# navigate `http://localhost:5777/examples/simple.html`

Test

npm test

:copyright: MIT - Atma.js Project

FAQs

Package last updated on 11 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts