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

angular-ticker

v1.0.0

Published

An AngularJS component for tickers.

Downloads

6

Readme

angular-ticker

A (stupid) AngularJS component for tickers.

Table of contents

Demo

Here.

Note: A copy of the demo code is inside the demo folder of this repository.

Usage

Basic

<msl-ticker
  text="'Talk is cheap. Show me the code!'"
  length="'7'"
  period="'250'">
</msl-ticker>

Note that:

  • text is the text to display
  • length is the number of cells for the ticker
  • period is the time interval after which a character moves to the next cell (measured in milliseconds)

Also, keep in mind that styling is up to you. See the Styling section.

Dynamic

<msl-ticker
  text="your_text"
  length="your_length"
  period="your_period">
</msl-ticker>

...provided that your_text, your_length, your_period are suitable values available inside the enclosing scope.

Defaults

Parameters are all optional, i.e. you can even write something like this:

<msl-ticker></msl-ticker>

When parameters are omitted default values from the MslTickerDefaults service are used. This service is actually a plain JS object with a TEXT, LENGTH and PERIOD properties representing the default values:

angular.module('testDefaults', ['msl.ticker']).
  controller('TestDefaultsCtrl' function (MslTickerDefaults) {
    console.log(MslTickerDefaults.TEXT); // 'Talk is cheap. Show me the code!'
    console.log(MslTickerDefaults.LENGTH); // 7
    console.log(MslTickerDefaults.PERIOD); // 250
  });

If you don't like these defaults, you can change them inside a config block:

angular.module('testDefaults', ['msl.ticker']).
  config(function (MslTickerDefaultsProvider) {
    MslTickerDefaultsProvider.text(':-D');
    MslTickerDefaultsProvider.length(5);
    MslTickerDefaultsProvider.period(500);
  });

Styling

The HTML template for the ticker is just a sequence of divs (with display: inline-block;), e.g.:

<msl-ticker>
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  <div>F</div>
  <div>O</div>
  <div>O</div>
  <div>&nbsp;</div>
  <div>B</div>
  <div>A</div>
  <div>R</div>
</msl-ticker>

Use the msl-ticker > div selector for further customization. A nice example is inside the demo folder.

Keep in mind that the purpose of the ticker is to move characters from cell to cell: how a cell can be styled is not (completely) part of the API.

How to put it in your app

The ticker component is available inside an npm package called angular-ticker:

npm install angular-ticker

Once installed, remember to load the code:

<html>
  <head></head>
  <body>
    <script src="node_modules/angular-ticker/ticker.js"></script>
  </body>
</html>

...and to declare msl.ticker as a dependency:

var your_app = angular.module('yourApp', ['msl.ticker']);

API

Here is a more detailed, official description of what the ticker does and what you should (and should not) do when using the ticker.

Any behavior not explicitly documented there is to be intended as implementation-specific and should not be relied on.

Disclaimer

While nicely written and documented, this code was developed just for fun and is not tested (not in an automated fashion, at least). That being said, it seems to me that is working well :D

Also note that this code is MIT-licensed.

Surprise!

You have read all this document?! Thank you. Here is a little gift: the demo website of this repo supports text, length and period customization through query parameters. You can use this feature to send funny messages to your friends, e.g.:

https://marcoliceti.github.io/angular-ticker/demo/#!?text=eat%20my%20shorts