@santech/core
TypeScript icon, indicating that this package has built-in type declarations

7.0.0-beta.4 • Public • Published

@santech/core Dependency Status devDependency Status

@santech/core is a npm module that exports core models of the santech studio

Prerequisites

You need to have globally installed:

  • node 9.x.x
  • npm 5.x.x
  • yarn 1.x.x

Development

Install all the dependencies

yarn

Launch tests

npm test

Build the package

yarn build

Publish the package

npm publish

Require package in your project

npm i @santech/core -S

Import module

import { Http } from '@santech/core';
// or
var Http = require('@santech/core').Http;
// or
var Http = Santech.Core.Http;

Examples

Angular 1

<script type="text/javascript" src="./node_modules/@santech/core/dist/umd/index.js"></script>
class MyCtrl {
  constructor(http) {
    http.get('some/url')
      .then((res => {
        console.log(res.data.foo);
      });
  }
}

angular.module('santech', [])
  .factory('santech-http', () => new Santech.Core.Http(fetch, Headers))
  .controller('MyCtrl', ['santech-http', MyCtrl])
  .run(['santech-http', '$rootScope', function (http, $rootScope) {
    http.addInterceptor({
      response: (res) => {
        $rootScope.$applyAsync();
        return res;
      }
    })
  }]);

Angular 2

import { Component, Optional } from '@angular/core';
import { Http } from '@santech/core';

interface FooBar {
  foo: string;
}

@Component({
  providers: [{
    provide: Http,
    useFactory: () => new Http(fetch, Headers),
  }],
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  constructor(http: Http) {
    http.get<FooBar>('some/url')
      .then((res => {
        console.log(res.data.foo);
      });
  }
}

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i @santech/core

    Weekly Downloads

    3

    Version

    7.0.0-beta.4

    License

    MIT

    Unpacked Size

    1.17 MB

    Total Files

    112

    Last publish

    Collaborators

    • outilssantech