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

@aller/cyclops-frontend-vanilla

Package Overview
Dependencies
Maintainers
14
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aller/cyclops-frontend-vanilla

Vanilla JS implementation of login-button

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
480
increased by1986.96%
Maintainers
14
Weekly downloads
 
Created
Source

cyclops-frontend-vanilla

This package is for vanilla-js DOM-manipulation for cyclops-functions. As of now, it only contains code for injecting the login-button/showing your name in the place of the login-button.

Table of Contents

Functions

injectUser

import { injectUser } from '@aller/cyclops-frontend-vanilla'

injectUser(elementId, domain?, ILoginButton?)

For users that want the least possible bloat, imports should be handled as such:

import { injectUser } from "@aller/cyclops-frontend-vanilla/lib/components/loginButton";

Instead of importing everything the index.ts forward-exports, it only imports the element that is wanted/needed. This could help tree-shaking in cases where there are no tree-shaking done on transpiling.

Injects a login-button to the elementId sent in as a parameter and fetches whether the user is logged in.

If you want to test the functionality on a non-relative domain, the domain can also be sent with as a parameter.

This function can include an object of the type ILoginButton interface for customizable classes and texts. Here are the defaults:

{
  dropdownButtonClass: "cyclops-dropbtn",
  dropdownContentClass: "cyclops-dropdown-content",
  dropdownClass: "cyclops-dropdown",
  containerContentClass: "cyclops-login",
  loginText: "Logg Inn",
  logoutText: "Logg Ut",
  myPageText: "Minside",
  extraLinks: []
}

For adding more custom elements in the user-dropdown, the property extraLinks can be used. This property can hold elements of the interface:

interface IExtraLink {
  text: string;
  href: string;
}

If the property extraLinks remain empty, there will only be added the default "Minside" and "Logg Ut" buttons. If the extraLinks are defined, these links will appear between the "Minside" and "Logg Ut" links.

TODO

Add more vanilla-js DOM-manipulation code, for different functions. So far it is only injectUser that has its own vanilla-JS element. This should probably be expanded when/if needed.

FAQs

Package last updated on 19 May 2020

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

  • 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