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

ndla-audio-search

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndla-audio-search

A simple library for searching for audio files from NDLA

  • 0.4.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

A simple library for selecting NDLA audio files.

Installation

$ npm install ndla-audio-search

Usage

Styling

/* Your project's main .scss import file */
@import '~ndla-audio-search/scss/audio-search'; // with webpack and sass-loader
@import '../path/to/node_modules/ndla-audio-search/scss/audio-search'; // direct reference

Get audio with the audio selector

To use the AudioSearch component, some functions for handling search and fetching audios are needed. In addition, some translations are needed.

import AudioSearch from 'ndla-audio-search';

const searchAudios = queryObject => {
  // Return new Promise of audio objects
};

const fetchAudio = id => {
  // Return new Promise of a single audio object
};

const onError = err => {
  // Handle error
};

const audioSelect = audio => {
  // Handle audio selection
};

const translations = {
  searchPlaceholder:  /* Translated string */,
  searchButtonTitle:  /* Translated string */,
  useAudio:           /* Translated string */,
  noResults:          /* Translated string */,
};


<AudioSearch
  translations={translations}
  fetchAudio={fetchAudio}
  searchAudios={searchAudios}
  onAudioSelect={audioSelect}
  onError={onError}
  queryObject={defaultQueryObject}
/>

A queryObject must look like this:

{
  query:    /* Query string */,
  page:     /* Page number */,
  pageSize: /* Page size (elements per page) */,
  locale:   /* The search language; usually provided by the front-end */,
}

Keywords

FAQs

Package last updated on 30 Oct 2018

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