npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

utilidades-core

v7.0.8-beta1

Published

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.

Downloads

5

Readme

UtilidadesCore

This library was generated with Angular CLI version 8.

1. Configuración de environment.

La librería recibe como parametro el environment con las siguientes variables definidas.

*/  environment.ts  */
export const environment = {
  production: false,
  
  entorno: 'test', // para menú de aplicaciones
  notificaciones: true, // Inicializar notificaciones
  menuApps: true, // Inicializar menú de aplicaciones
  
  CONFIGURACION_SERVICE: 'https://autenticacion.portaloas.udistrital.edu.co/'+
  'apioas/configuracion_crud_api/v1/',
  NOTIFICACION_SERVICE: 'wss://pruebasapi.portaloas.udistrital.edu.co:8116/ws',
  ...,
  TOKEN: {
      AUTORIZATION_URL: ...,
      CLIENTE_ID: ....,
      RESPONSE_TYPE: ...,
      SCOPE: ...,
      REDIRECT_URL: ...,
      SIGN_OUT_URL: ...,
      SIGN_OUT_REDIRECT_URL: ...,
  },
};

2. Importar el módulo.

Si está usando nebular, importe en en módulo theme, de lo contrario importe en el módulo principal o según convenga.

*/ theme.module.ts  */

import { 
  NotioasModule,  
  MenuAplicacionesModule, 
  UtilidadesCoreModule, 
} from 'utilidades-core';

const UTILIDADES_CORE = [
  NotioasModule,
  MenuAplicacionesModule,
  UtilidadesCoreModule, 
];


@NgModule({
  imports: [...UTILIDADES_CORE],
  exports: [...BASE_MODULES, ...NB_MODULES, ...COMPONENTS, ...PIPES, ...MAT_MODULES],
  declarations: [...COMPONENTS, ...PIPES, DinamicformComponent, SelectComponent],
  entryComponents: [...ENTRY_COMPONENTS],
})

3. html

Use el componente en el header para notificaciones lib-notioas, para menú de aplicaciones menu-aplicaciones, también puede construir los botones para mostrar y ocultar cada panel.

*/ header.component.html  */

<div class="header-container" [class.left]="position === 'normal'" [class.right]="position === 'inverse'">
  ...
  <lib-notioas></lib-notioas>
  <menu-aplicaciones></menu-aplicaciones>
  ...
 </div>


  <nb-action class="control-item" icon="nb-notifications" 
  [badgeText]="notificacionService.noNotify$ | async"
  badgeStatus="danger" 
  (click)="toggleNotifications()">
  </nb-action>
  <nb-action class="control-item" icon="nb-grid-b" 
  (click)="abrirMenu()">
  </nb-action>

...

4. typescript

Puede inicializar la librería pasando cómo parametro el environment, también puede usar el método toogleMenuNotify() de cada componente.


```*/ header.component.ts  */

import { NotioasService, 
        MenuAplicacionesService, 
        UtilidadesCoreService  } 
from 'utilidades-core';
...
@Component({
  selector: 'ngx-header',
  styleUrls: ['./header.component.scss'],
  templateUrl: './header.component.html',
})
export class HeaderComponent {
constructor(
    public notificacionService: NotioasService,
    private utilidadesService: UtilidadesCoreService,
    private menuAplicacionesService: MenuAplicacionesService
	...
) {
	...
    this.liveToken();
  }


 liveToken() {
    if (window.Auth.live()) {
      this.liveTokenValue = window.Auth.live();
      this.username = (window.Auth.getPayload()).sub;
      this.utilidadesService.initLib(environment);
    }
    return window.Auth.live();
  }
  
    toggleNotifications() {
    this.notificacionService.toogleMenuNotify();
  }

  abrirMenu() {
    this.menuAplicacionesService.toogleMenuNotify();
  }
}

5. Añada en main.ts

/*   main.ts     */


import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { ImplicitAutenticationService } from 'utilidades-core';

if (environment.production) {
  enableProdMode();
}

declare global {
  interface Window { Auth: any; }
}

window.Auth = window.Auth || {};

window.Auth = new ImplicitAutenticationService;
window.Auth.init(environment.TOKEN);
const isButtonLogin = false;

if (window.Auth.login(isButtonLogin)) {
  window.Auth.live();
}

// autenticacion.clearUrl();

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));