Socket
Book a DemoInstallSign in
Socket

@webex/common

Package Overview
Dependencies
Maintainers
8
Versions
1293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webex/common

Common utilities for Cisco Webex

latest
Source
npmnpm
Version
3.10.0
Version published
Weekly downloads
11K
16.67%
Maintainers
8
Weekly downloads
 
Created
Source

@webex/common

Utility functions and helpers for the Cisco Webex JS SDK.

Install

npm install --save @webex/common

What it Does

This package provides essential utility functions used throughout the Webex SDK. While many exports are designed for internal SDK use, several utilities can be useful in general applications.

Usage

Capped Debounce

A debounce function that executes after a time delay OR after a maximum number of calls.

import {cappedDebounce} from '@webex/common';

const debouncedFn = cappedDebounce(
  () => console.log('Executed!'),
  1000, // Wait 1 second
  {
    maxWait: 5000,  // Execute after 5 seconds maximum
    maxCalls: 10    // Execute after 10 calls maximum
  }
);

// Will execute after 1 second of inactivity, 10 calls, or 5 seconds total
debouncedFn();

Defer

Creates a deferred promise with exposed resolve/reject methods.

import {Defer} from '@webex/common';

const deferred = new Defer();

// Resolve later
setTimeout(() => {
  deferred.resolve('Success!');
}, 1000);

deferred.promise.then(result => {
  console.log(result); // 'Success!'
});

One Flight

Decorator that ensures a method only runs one instance at a time, preventing duplicate calls.

import {oneFlight} from '@webex/common';

class MyClass {
  @oneFlight
  async fetchData() {
    // This will only run one instance at a time
    // Subsequent calls while running will return the same promise
    return await fetch('/api/data');
  }
}

Exception

Utility for creating custom error types.

import {Exception} from '@webex/common';

const MyError = Exception.extend('MyError');
throw new MyError('Something went wrong');

Tap

Utility for debugging promise chains without affecting the flow.

import {tap} from '@webex/common';

fetch('/api/data')
  .then(tap(response => console.log('Response received:', response)))
  .then(response => response.json())
  .then(tap(data => console.log('Data parsed:', data)));

Deprecated

Decorator for marking methods as deprecated.

import {deprecated} from '@webex/common';

class MyClass {
  @deprecated('Use newMethod() instead')
  oldMethod() {
    // Will log deprecation warning when called
  }
}

Available Utilities

  • cappedDebounce - Debounce with call count limit
  • defer - Deferred promise creation
  • deprecated - Deprecation warnings
  • exception - Custom error types
  • oneFlight - Prevent duplicate method calls
  • tap - Debug promise chains

SDK Integration

These utilities are primarily designed for use within the Webex SDK ecosystem but can be useful in any JavaScript application requiring these common patterns.

Maintainers

This package is maintained by Cisco Webex for Developers.

Contribute

Pull requests welcome. Please see CONTRIBUTING.md for more details.

License

© 2016-2025 Cisco and/or its affiliates. All Rights Reserved.

FAQs

Package last updated on 28 Oct 2025

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