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

ngx-fi-styles-loader

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

ngx-fi-styles-loader

A streamlined approach to load styles dynamically

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NgxFiStylesLoader

A streamlined approach to load styles dynamically

Installation

  • npm i lodash --save
  • npm i @types/lodash --save-dev
  • npm i ngx-fi-lodash --save
  • npm i ngx-fi-styles-loader --save

How to use

In a module

import { NgModule } from "@angular/core";
import { NgxFiStylesLoaderModule } from "ngx-fi-styles-loader";

@NgModule({
  imports: [NgxFiStylesLoaderModule], // for consumption within the scope of the module
  exports: [NgxFiStylesLoaderModule] // if propagation is required
})
export class SomeModule {}

Where required

import { StyleHandlingMode, StylesLoaderService } from "ngx-fi-styles-loader";

export class SomeClass {
  constructor(private loaderService: StylesLoaderService) {}
}

For testing

import { NgxFiStylesLoaderTestingModule, StylesLoaderMockService, StylesLoaderService } from "ngx-fi-styles-loader";

describe('TestingTitle', () => {
  let stylesLoaderService: StylesLoaderMockService;
  beforeEach(async(() => {
      TestBed.configureTestingModule({
        imports: [NgxFiStylesLoaderTestingModule]
      });

      stylesLoaderService = TestBed.get(StylesLoaderService);
    }));
  }));
}));

Notes

  • components:

    • StylesLoaderComponent / styles-loader: to be used when managed loading of styles is required
    • StylesLoaderRawComponent / styles-loader-raw: to be used when un-managed loading of styles is required
  • enums:

    • StyleHandlingMode
    • PassThrough: just passes the url to be loaded
    • VerifiedPassThrough: downloads content first, passed the url to be loaded on success
    • Literal: downloads the content and passes it as an object url; should not be used when stylesheet contains any relative paths referencing assets
  • services:

    • StylesLoaderService: used in conjuction with StylesLoaderComponent to load styles; in addition, info regarding the loading status of a style(s) are provided

      export interface IStylesLoaderService {
        loadingStyles$: Observable<{ [key: string]: string }>;
      
        isStyleLoading(url: string): boolean;
      
        isStyleLoading$(url: string): Observable<boolean>;
      
        areStylesLoading(urls: string[]): boolean;
      
        areStylesLoading$(urls: string[]): Observable<boolean>;
      
        getStyle$(url: string, styleHandlingMode?: StyleHandlingMode): Observable<string>;
      }
      

Keywords

FAQs

Package last updated on 07 Apr 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