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

@kjots/geheugen-angular

v2.0.0

Published

Angular bindings for geheugen

Downloads

1

Readme

geheugen-angular

Build Status npm version

Angular bindings for geheugen.

Installation

npm install --save @kjots/geheugen-angular

Usage

<script src="babel-polyfill/dist/polyfill.js"></script>
<script src="angular/angular.js"></script>

<script src="@kjots/geheugen-angular/dist/geheugen-angular.js"></script>

<script>
    angular.module('exampleApp', [ 'geheugen' ]);
</script>

API

Constants

Memo

Type: Class

The geheugen Memo class.

memos.registry

Type: Object<String,Memo>

The registry of geheugen Memo instances, keyed by their name.

Services

memosProvider(name)

Type: Function

Returns an Angular factory1 for the resolved value of the memo with the provided name.

The return value of this function is suitable for being used as a dependency of an Angular route, e.g.:

angular.module('exampleApp')
    .config(($routeProvider, memosProvider) => {
        $routeProvider.when('/exampleRoute', {
            resolve: {
                example: memosProvider('example')
            }
        });
    });
name

Type: String

The name of the memo.

memosProvider(name, [opts], factory)

Type: Function

Register a memo with the provided name.

Returns an Angular factory1 for the memo.

The return value of this function is suitable for being used as the $get method of an Angular provider, e.g.:

angular.module('exampleApp')
    .provider('exampleMemo', function (memosProvider) {
        this.$get = memosProvider('example',
            $filter => $filter('number')('3.1415', 2));
    });
name

Type: String

The name of the memo.

opts

Type: Object<String, ?>

Default: {}

The memo options.

properties

Type: Object<String, Object>

The memo properties.

These properties will be defined on the memo via Object.defineProperties().

Properties with the names get, set, reset, and resetDependants will be ignored.

singleton

Type: Boolean

Default: true

The singleton flag.

dependencies

Type: Array<String>

Default: []

The dependencies of the memo.

This array contains the names of the memos upon which this memo depends.

The resolved values of the dependant memos will be available as locals to the Angular factory1 provided via factory, e.g.:

angular.module('exampleApp')
    .provider('dependencyMemo', function (memosProvider) {
        this.$get = memosProvider('dependency', () => '3.1415');
    })
    .provider('exampleMemo', function (memosProvider) {
        this.$get = memosProvider('example', { dependencies: [ 'dependency' ] },
            ($filter, dependency) => $filter('number')(dependency, 2));
    });
onSet

Type: Function

The set event handler.

This function will be invoked when the memo is set.

This function will be invoked via $injector.invoke().

The value of the memo will be available as the value local to this function.

onReset

Type: Function

The reset event handler.

This function will be invoked when the memo is reset.

This function will be invoked via $injector.invoke().

factory

Type: Function or Array<String|Function>

The Angular factory1 for the resolved value of the memo.

The factory can return the either resolved value itself or a promise for the resolved value.

memos(name)

Type: Function

Returns the resolved value of the memo with the provided name.

name

Type: String

The name of the memo.

memos.get(name)

Type: Function

Return the value of the memo with the provided name.

name

Type: String

The name of the memo.

memos.set(name, value)

Type: Function

Update the value of the memo with the provided name.

name

Type: String

The name of the memo.

value

Type: ?

The value.

memos.reset(name)

Type: Function

Reset the memo with the provided name.

name

Type: String

The name of the memo.

memos.resetDependants(name)

Type: Function

Reset the dependants of the memo with the provided name.

name

Type: String

The name of the memo.

Instances

memo()

Type: Function

Returns the resolved value of the memo.

A memo instance can be created via memosProvider().

memo.get()

Type: Function

Return the value of the memo.

memo.set(value)

Type: Function

Update the value of the memo.

value

Type: ?

The value.

memo.reset()

Type: Function

Reset the memo.

memo.resetDependants()

Type: Function

Reset the dependants of the memo.

Notes