Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sling-web-component-loader

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sling-web-component-loader - npm Package Compare versions

Comparing version 0.17.0 to 1.3.0

dist/cjs/es5/component/Loader.js

17

package.json
{
"name": "sling-web-component-loader",
"version": "0.17.0",
"description": "",
"main": "dist/cjs/index.js",
"jsnext:main": "dist/es/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.3.0",
"description": "Sling Web Component Loader",
"module": "src/index.js",
"main": "dist/cjs/es6/index.js",
"jsnext:main": "dist/es/es6/index.js",
"browser": "dist/iife/es6/index.js",
"author": "Stone Pagamentos",
"dependencies": {
"sling-web-framework": "^0.17.0",
"sling-web-helpers": "^0.17.0"
"sling-framework": "^1.3.0",
"sling-helpers": "^1.3.0"
}
}

@@ -6,29 +6,43 @@ # sling-web-component-loader

This component renders a card element with the merchant contacts information within. It table basic components as content wrapper.
## Install
## Usage
This is how you set the loader into the business component script structure
In the business component script, the RENDER method must be made as show below:
```js
render() {
return html`
<div className="business-component loading_${this.loading > 0}">
<sling-loader loading="${this.loading > 0}"></sling-loader>
... other components
</div>
`;
}
```
npm instal sling-web-component-loader
```
The mapStateToProps function must include the LOADING property, which is used to map the state of the component
API requests and responses and trigger the render changes.
## Tag
```js
export const mapStateToProps = state => ({
apidata: // ...component data store node
loading: state.globalReducer.loaders[instanceName],
});
```HTML
<sling-loader></sling-loader>
```
## Project Wiki:
https://stonepayments.atlassian.net/wiki/spaces/APICLIENTE
## Dependencies
* **sling-framework**
* **sling-helpers**
## Attributes and properties
|Name|Type|Default Values|ReflectToAttribute|Observer|callSdk|
|:--|:--|:--|:--:|:--|:--:|
|loading|Boolean||:heavy_check_mark:|
### Description
|Name|Description|
|:---|:---|
|loading |Boolean that defines if the loader will be displayed.|
## Events
This component have no event.
## Examples
All component examples can be emulated using the `npm start sling-web-component-loader` command.
### Use
```HTML
<sling-loader loading></sling-loader>
```

@@ -1,2 +0,2 @@

import { SlingElement, html } from '../../node_modules/sling-web-framework/src/index.js';
import { SlingElement, html } from 'sling-framework';

@@ -20,3 +20,3 @@ export class Loader extends SlingElement {

<style>
@import url('../sling-web-component-loader/src/index.css');
@import url('sling-web-component-loader/src/index.css');
</style>

@@ -23,0 +23,0 @@ <div className="${className}">

@@ -1,4 +0,33 @@

/* eslint-disable */
import { registerComponent } from 'sling-helpers';
import { Loader } from './Loader.js';
// TODO Write me!
registerComponent('sling-loader', Loader);
let $loader;
describe('Loader', () => {
beforeEach(() => {
$loader = document.createElement('sling-loader');
document.body.appendChild($loader);
});
afterEach(() => {
document.body.removeChild($loader);
$loader = undefined;
});
it('Should reflect "loading" attribute to property ', () => {
$loader.setAttribute('loading', '');
expect($loader.hasAttribute('loading')).to.be.true;
});
it('Should reflect "loading" property to attribute ', (done) => {
$loader.loading = false;
setTimeout(() => {
expect($loader.hasAttribute('loading')).to.be.false;
done();
});
});
});

@@ -1,4 +0,4 @@

import { domHelper } from '../node_modules/sling-web-helpers/src/index.js';
import { registerComponent } from 'sling-helpers';
import { Loader } from './component/Loader.js';
domHelper.registerComponent('sling-loader', Loader);
registerComponent('sling-loader', Loader);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc