@screencloud/screencloud-apps-sdk
This npm module contain reusable scripts for apps.
Last updated 3 years ago by alexandrtovmach .
ISC · Original npm · Tarball · package.json
$ cnpm install @screencloud/screencloud-apps-sdk 
SYNC missed versions from official npm registry.

ScreenCloud apps SDK

This npm module contain reusable scripts for apps.

DEPRECATED

  • dateConvertor ― use instead special npm packages or new Date() constructor
  • dateTimeHelper ― use instead special npm packages or new Date() constructor
  • query.params ― use instead npm package
  • geocodeHelper ― not any relations in current apps, so it deprecated
  • promiseUtil ― not any relations in current apps, so it deprecated
  • QRCode ― not any relations in current apps, so it deprecated.
  • scLog ― it's bad practice and deprecated.
  • localCache ― deprecated after refactoring ThemeManager.

Get started

  1. npm install --save @screencloud/screencloud-apps-sdk
  2. Import modules

triggerEvents

Main module with emitters to sending events to the parent frame from app.

import { triggerEvents } from "@screencloud/screencloud-apps-sdk"

// ... //
  componentDidMount() {
    triggerEvents.on("start", () => triggerEvents.sendAppStatusStarted());
  }

  ...

  onSubmit(login, password) {
    if (login && password) {
      const jwt = encrypt({
        login: login,
        password: password
      })
      triggerEvents.callbackSuccess(jwt);
    } else {
      triggerEvents.callbackError(new Error("Login failed"))
    }
  }
// ... //

List of methods:

  • sendAppStatusPreloaded()
  • sendAppStatusStarted()
  • sendAppStatusFinished()
  • sendAppError(data)
  • callbackSuccess(data) // to send data to ScreenCloud (for example after login)
  • callbackError(data) // to send error to ScreenCloud (for example after login)

logger (beta)

import { logger } from "@screencloud/screencloud-apps-sdk"

if (process.env.NODE_ENV === 'development') {
  logger.init();
}

List of methods:

  • init() // initialize the rendering logs on window

ThemeComponent

import { ThemeComponent } from "@screencloud/screencloud-apps-sdk"
import queryString from 'query-string'

const parsedQuery = queryString.parse(window.location.search)

// ... //
constructor(props) {
    super(props);
    this.state = {
      theme: parsedQuery.theme
    }
}

getThemeData(data) {
  console.log(`Theme object: ${data}`)
}

render() {
  return (
    <ThemeComponent theme={this.state.theme} getThemeDataObject={this.getThemeData}>
      /* your application code */
    </ThemeComponent>
  )
}
// ... //

List of properties:

  • theme // themeID string

List of methods:

  • getThemeDataObject // return {"colorBgPrimary":"#feb62c","colorTextBody":"#1f1f1f","colorTextHeading":"#fb0004","colorTextLink":"#ff3a00","fontBody":"Oswald","fontHeading":"Fjalla One","fontUrlBody":"","fontUrlHeading":"","id":"...","name":"Kodak"} or {}

animationControlHelper (will be DEPRECATED)

On/off animation.css. Will be deprecated because current functuonality affect only to old apps in monorepo.

import { animationControlHelper } from "@screencloud/screencloud-apps-sdk"

// ... //
  componentDidMount() {
      animationControlHelper.enableAnimation();
      // animationControlHelper.disableAnimation();
  }
// ... //

List of methods:

  • enableAnimation() // remove disable-animated class from body element
  • disableAnimation() // add disable-animated class from body element

checkScreenLayout (will be DEPRECATED)

Functionality to get viewport layout type.

import { checkScreenLayout } from "@screencloud/screencloud-apps-sdk"

// ... //
  const layoutClass = checkScreenLayout();
// ... //

List of methods:

  • getLayout(forcedLayoutClass?) // get layout type; set up layout name as class to body element (WILL BE DEPRECATED WITH MONOREPO)

List of properties:

  • LAYOUT_CLASS_PORTRAIT // "portrait"
  • LAYOUT_CLASS_LANDSCAPE // "landscape"
  • LAYOUT_CLASS_TICKERTAPE // "tickertape"
  • LAYOUT_CLASS_SUPERWIDE // "superwide"
  • LAYOUT_CLASS_SQUARE // "square"

deviceDetection (will be DEPRECATED)

Functionality to detect the device type/model. Will be deprecated, please use device-detector npm package instead.

import { deviceDetection } from "@screencloud/screencloud-apps-sdk"

deviceDetection // 'iOS', 'Android', 'Windows Phone', or 'unknown'

colorHelper (will be DEPRECATED)

Module with methods for easy work with colors. (will be deprecated, use third party modules instead)

import { colorHelper } from "@screencloud/screencloud-apps-sdk"

const redHEX = "#ff0000"
const darkRedHEX = colorHelper.colorLuminance(redHEX, -0.2); // #cc0000
const darkOrLight = colorHelper.checkContrast(redHEX); // dark

List of methods:

  • colorLuminance(hex, luminDiff)
  • checkContrast(hex)

urlHelper (will be DEPRECATED)

Module with methods for easy work with colors. (will be deprecated)

import { urlHelper } from "@screencloud/screencloud-apps-sdk"

// ... //
  const url = urlHelper.cleanIframeUrl("<iframe src="https://google.com"></iframe>"); // "https://google.com"
// ... //

List of methods:

  • cleanIframeUrl(iframeHTMLString)

youtubeHelper (will be DEPRECATED)

Module with methods for easy work with colors. (will be deprecated)

import { youtubeHelper } from "@screencloud/screencloud-apps-sdk"

// ... //
  youtubeHelper.extractYoutTubeIds(messageText)
// ... //

List of methods:

  • extractYoutTubeIds(string)
  • isContainYouTubeURL(string) // true|false
  • isValidYouTubeURL(url) // true|false

Current Tags

  • 0.1.80                                ...           latest (3 years ago)

80 Versions

  • 0.1.80                                ...           3 years ago
  • 0.1.79                                ...           3 years ago
  • 0.1.78                                ...           3 years ago
  • 0.1.77                                ...           3 years ago
  • 0.1.76                                ...           3 years ago
  • 0.1.75                                ...           3 years ago
  • 0.1.74                                ...           3 years ago
  • 0.1.73                                ...           3 years ago
  • 0.1.72                                ...           3 years ago
  • 0.1.71                                ...           3 years ago
  • 0.1.70                                ...           3 years ago
  • 0.1.69                                ...           3 years ago
  • 0.1.68                                ...           3 years ago
  • 0.1.67                                ...           3 years ago
  • 0.1.66                                ...           3 years ago
  • 0.1.65                                ...           3 years ago
  • 0.1.64                                ...           3 years ago
  • 0.1.63                                ...           3 years ago
  • 0.1.62                                ...           3 years ago
  • 0.1.61                                ...           3 years ago
  • 0.1.60                                ...           3 years ago
  • 0.1.59                                ...           3 years ago
  • 0.1.58                                ...           3 years ago
  • 0.1.57                                ...           4 years ago
  • 0.1.56                                ...           4 years ago
  • 0.1.55                                ...           4 years ago
  • 0.1.54                                ...           4 years ago
  • 0.1.53                                ...           4 years ago
  • 0.1.52                                ...           4 years ago
  • 0.1.51                                ...           4 years ago
  • 0.1.50                                ...           4 years ago
  • 0.1.49                                ...           4 years ago
  • 0.1.47                                ...           4 years ago
  • 0.1.46                                ...           4 years ago
  • 0.1.45                                ...           4 years ago
  • 0.1.44                                ...           4 years ago
  • 0.1.43                                ...           4 years ago
  • 0.1.42                                ...           4 years ago
  • 0.1.41                                ...           4 years ago
  • 0.1.40                                ...           4 years ago
  • 0.1.39                                ...           4 years ago
  • 0.1.38                                ...           4 years ago
  • 0.1.37                                ...           4 years ago
  • 0.1.36                                ...           4 years ago
  • 0.1.35                                ...           4 years ago
  • 0.1.34                                ...           4 years ago
  • 0.1.33                                ...           4 years ago
  • 0.1.32                                ...           4 years ago
  • 0.1.31                                ...           4 years ago
  • 0.1.30                                ...           4 years ago
  • 0.1.29                                ...           4 years ago
  • 0.1.28                                ...           4 years ago
  • 0.1.27                                ...           4 years ago
  • 0.1.26                                ...           4 years ago
  • 0.1.25                                ...           4 years ago
  • 0.1.24                                ...           4 years ago
  • 0.1.23                                ...           4 years ago
  • 0.1.22                                ...           4 years ago
  • 0.1.21                                ...           4 years ago
  • 0.1.20                                ...           4 years ago
  • 0.1.19                                ...           4 years ago
  • 0.1.18                                ...           4 years ago
  • 0.1.17                                ...           4 years ago
  • 0.1.16                                ...           4 years ago
  • 0.1.15                                ...           4 years ago
  • 0.1.14                                ...           4 years ago
  • 0.1.13                                ...           4 years ago
  • 0.1.12                                ...           4 years ago
  • 0.1.11                                ...           4 years ago
  • 0.1.10                                ...           4 years ago
  • 0.1.9                                ...           4 years ago
  • 0.1.8                                ...           4 years ago
  • 0.1.7                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Downloads
Total 4,364
Today 0
This Week 0
This Month 160
Last Day 0
Last Week 160
Last Month 80
Dependencies (4)
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2021 © npmmirror.com |