Skip to content
This repository was archived by the owner on Jan 27, 2024. It is now read-only.
This repository was archived by the owner on Jan 27, 2024. It is now read-only.

Make _.delay(), _.throttle(), and _.debounce() karma friendly #21

Description

@mvindahl

The three functions share the common trait that they use the native setTimeout function.

In angular, it's best practise to use $timeout instead. It offers the same signature, and on top of that it makes it possible to "short circuit time" from karma tests by calling $timeout.flush().

As far as implementation goes, I'm thinking of something along the lines of making the underscoreModule depend upon $timeout and including the three functions from underscore.js as shivs, replacing all instances of 'setTimeout' with '$timeout'.

If you approve of the idea, I could try to make it work and submit a pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions