0.0.7 β€’ Published 4 years ago

javascripter v0.0.7

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

JavaScripter

A library for loading scripts πŸ˜„

npm.io

Usage

Component

import { Component } from "@angular/core";
import { JavaScripter } from "javascripter";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.scss"]
})
export class AppComponent {
  title = "javascripter-demo-app";
  constructor(private javascripter: JavaScripter) {
    this.javascripter.createScripts([
      "https://cdnjs.cloudflare.com/ajax/libs/animejs/2.2.0/anime.js",
      "https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js",
      "https://code.jquery.com/jquery-3.3.1.slim.min.js"
    ]);

    this.javascripter.onLoaded.subscribe(loaded => {
      // Do something...
    });
  }
}

Module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { JavaScripterModule } from 'javascripter';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    JavaScripterModule.forRoot({logger: false})  // To remove logs
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Was this lib useful?

If you found this lib useful, please ⭐️the lib to show your appreciation! In the spirit of open-source, share this lib with others in the community who might find it useful πŸ˜€