Socket
Book a DemoInstallSign in
Socket

generate-js-custom-element

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generate-js-custom-element

A model for building custom UI components using Generat-JS

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

Custom-Element

A model for building custom UI components using Generat-JS

Dependencies

  • generate-js
  • jQuery
  • Bars
  • CustomElement

Example

var CustomElement = require('../utils/custom-element'),
    Bindable = require('generate-js-bindings');

var config = {
    templates: {
        index: 'No template set for {{@key}}.'
    }
};

var MyElement = CustomElement.createElement(config, function MyElement(options) {
    var _ = this;

    _.supercreate(options);
});

Bindable.generateGettersSetters(MyElement, ['specialVar']); // Optionally add Getter/Setters

MyElement.definePrototype({
    myMethod: function myMethod(done) {
        typeof done === 'function' && done();
    }
});

module.exports = MyElement;

Now, you can create an element like so:

var el = MyElement.create({
    $element: $('#myelement')
});

Then, you can:

el.set('name', 'Things');
el.update();

Or, for variables that have been declared through generate-js-bindings generateGettersSetters method:

el.specialVar = 'Hi, world!';
el.update();

FAQs

Package last updated on 27 Oct 2015

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.