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

@caspingus/lt

v2.19.0

Published

A utility library of helpers and tools for working with Learnosity APIs.

Downloads

447

Readme

LT - Learnosity Toolkit

This is a utility library of helper modules and extensions that may be useful if you're developing with Learnosity APIs.

Modules and extensions are separated between Assessment (when using Items API) and Authoring (when using Author API).

See documentation here.

Important

This package is unofficial and wasn't created by Learnosity.

No modules contained within:

  • ever have access to the consumer private key
  • track any usage or personal information

Everything is open source under the MIT license. Feel free to use as you see fit.

Installation

npm install @caspingus/lt

Usage

You can import core or index into your project, from the src folder.

core vs index

Recommendation - use core in all production settings.

The core module contains the LT toolkit only, no extensions. This is the smallest file size (around 3.5k gzipped) and may be all you need.

If you want 1 or 2 extensions, you can import them manually to keep the overall file size down.

import { LT } from '@caspingus/lt/src/assessment/core';
import * as columnResizer from '@caspingus/lt/src/assessment/extensions/accessibility/ux/columnResizer';

The index module contains everything in core along with all extensions except themes. This is the largest file size (~400k) This is useful in development if you want to browse the extensions, but also if you happen to use all the extensions in your project.

import { LT } from '@caspingus/lt/src/assessment/index';

^^ Importing index puts all extensions in LT.extensions.

src vs dist

Recommendation - use src and have your local build process bundle LT along with your application.

As this library will be imported into existing projects, it's recommended to use the src folder and include LT as a part of your build process.

In which case, import from the src folder and you're good to go. Another option is to import from dist which has been prod bundled by Webpack, but then you need to exclude this from your build process.

Initialize

Everything is written using ES6 modules. By default we use LT as a variable for the toolkit. If you want to change this, use named imports.

LT expects to be given the application instance in the readyListener, either Items API or Author API. From there you can call any method you want off the LT object.

Items API

// Declare and set your variable with the Items API LearnosityItems.init() method
const itemsApp = LearnosityItems.init(signedConfigObject);


// Pass that app instance to the Toolkit constructor
import { LT } from '@caspingus/lt/src/assessment/core';
import * as renderPDF from '@caspingus/lt/src/assessment/extensions/ui/renderPDF/index';

LT.init(itemsApp);

// Optionally call any extensions you might want
renderPDF.run();

// Put individual extensions in the LT object if that makes your life easier
LT.extensions = {
    renderPDF,
};
LT.extensions.renderPDF.run();


// Optionally add to the global scope (handy for development)
window.LT = LT;

Usage examples

import { LT } from '@caspingus/lt/src/assessment/core';

// See if the item was _fully_ attempted
LT.isItemFullyAttempted();

// See if we're on the last item in a section
LT.isLastItemInSection();

// See the question response object
LT.questionResponse();

Author API

// Declare and set your variable with the Author API LearnosityItems.init() method
const authorApp = LearnosityAuthor.init(signedConfigObject);


// Pass that app instance to the Toolkit constructor
import { LT } from '@caspingus/lt/src/authoring/core';
LT.init(authorApp);


// Optionally add to the global scope (for development)
window.LT = LT;

Usage examples

import { LT } from '@caspingus/lt/src/authoring/core';

// Injects a route hash to the URI so SPAs can load to a deep view from a full page refresh.
LT.routingHash();

Building

You should import from @caspingus/lt/src/* and let your build tool handle minifying and tree shaking etc.

Right now, the Authoring extension ssmlEditor requires that css be imported. Here is an example webpack.config:

{
    module: {
        rules: [
            {
                test: /\.((c|s[ac])ss)$/i,
                use: ['style-loader', 'css-loader', 'sass-loader'],
            },
        ],
    },
};