Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-timer-notification

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-timer-notification - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

72

dist/docs.json

@@ -14,3 +14,3 @@ {

"name": "options",
"docs": "Duration in seconds.",
"docs": "- Object containing the duration of the timer.",
"type": "{ duration: number; }"

@@ -23,6 +23,6 @@ }

"name": "param",
"text": "options Duration in seconds."
"text": "options - Object containing the duration of the timer."
}
],
"docs": "Starts the timer with a specified duration.",
"docs": "Starts the timer with the given duration in seconds.",
"complexTypes": [],

@@ -42,28 +42,33 @@ "slug": "starttimer"

{
"name": "getRemainingTime",
"signature": "() => Promise<{ remainingTime: number; }>",
"name": "pauseTimer",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<{ remainingTime: number; }>",
"tags": [
{
"name": "returns",
"text": "Remaining time in seconds."
}
],
"docs": "Gets the remaining time of the running timer.",
"returns": "Promise<void>",
"tags": [],
"docs": "Pauses the currently running timer.",
"complexTypes": [],
"slug": "getremainingtime"
"slug": "pausetimer"
},
{
"name": "resumeTimer",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Resumes the paused timer.",
"complexTypes": [],
"slug": "resumetimer"
},
{
"name": "addListener",
"signature": "(eventName: \"remainingTimeUpdate\", listenerFn: (data: { remainingTime: number; }) => void) => Promise<PluginListenerHandle>",
"signature": "(eventName: 'remainingTimeUpdate', listenerFunc: (data: { remainingTime: number; }) => void) => Promise<PluginListenerHandle>",
"parameters": [
{
"name": "eventName",
"docs": "Name of the event ('remainingTimeUpdate').",
"docs": "- The name of the event, e.g., \"remainingTimeUpdate\".",
"type": "'remainingTimeUpdate'"
},
{
"name": "listenerFn",
"docs": "Callback function with the remaining time.",
"name": "listenerFunc",
"docs": "- Callback function that receives the remaining time.",
"type": "(data: { remainingTime: number; }) => void"

@@ -76,14 +81,10 @@ }

"name": "param",
"text": "eventName Name of the event ('remainingTimeUpdate')."
"text": "eventName - The name of the event, e.g., \"remainingTimeUpdate\"."
},
{
"name": "param",
"text": "listenerFn Callback function with the remaining time."
},
{
"name": "returns",
"text": "A handle to remove the listener."
"text": "listenerFunc - Callback function that receives the remaining time."
}
],
"docs": "Listens for updates on the remaining time.",
"docs": "Listens for updates on the remaining time of the timer.",
"complexTypes": [

@@ -93,2 +94,23 @@ "PluginListenerHandle"

"slug": "addlistenerremainingtimeupdate-"
},
{
"name": "removeAllListeners",
"signature": "(eventName: string) => Promise<void>",
"parameters": [
{
"name": "eventName",
"docs": "- The name of the event to remove listeners for.",
"type": "string"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "eventName - The name of the event to remove listeners for."
}
],
"docs": "Removes all listeners for a given event.",
"complexTypes": [],
"slug": "removealllisteners"
}

@@ -95,0 +117,0 @@ ],

@@ -1,6 +0,6 @@

import { PluginListenerHandle } from "@capacitor/core";
import type { PluginListenerHandle } from '@capacitor/core';
export interface TimerNotificationPlugin {
/**
* Starts the timer with a specified duration.
* @param options Duration in seconds.
* Starts the timer with the given duration in seconds.
* @param options - Object containing the duration of the timer.
*/

@@ -15,17 +15,22 @@ startTimer(options: {

/**
* Gets the remaining time of the running timer.
* @returns Remaining time in seconds.
* Pauses the currently running timer.
*/
getRemainingTime(): Promise<{
remainingTime: number;
}>;
pauseTimer(): Promise<void>;
/**
* Listens for updates on the remaining time.
* @param eventName Name of the event ('remainingTimeUpdate').
* @param listenerFn Callback function with the remaining time.
* @returns A handle to remove the listener.
* Resumes the paused timer.
*/
addListener(eventName: "remainingTimeUpdate", listenerFn: (data: {
resumeTimer(): Promise<void>;
/**
* Listens for updates on the remaining time of the timer.
* @param eventName - The name of the event, e.g., "remainingTimeUpdate".
* @param listenerFunc - Callback function that receives the remaining time.
*/
addListener(eventName: 'remainingTimeUpdate', listenerFunc: (data: {
remainingTime: number;
}) => void): Promise<PluginListenerHandle>;
/**
* Removes all listeners for a given event.
* @param eventName - The name of the event to remove listeners for.
*/
removeAllListeners(eventName: string): Promise<void>;
}

@@ -1,6 +0,4 @@

import { WebPlugin } from "@capacitor/core";
import type { TimerNotificationPlugin } from "./definitions";
import { WebPlugin } from '@capacitor/core';
import type { TimerNotificationPlugin } from './definitions';
export declare class TimerNotificationWeb extends WebPlugin implements TimerNotificationPlugin {
private remainingTime;
private intervalId;
startTimer(options: {

@@ -10,5 +8,8 @@ duration: number;

stopTimer(): Promise<void>;
pauseTimer(): Promise<void>;
resumeTimer(): Promise<void>;
getRemainingTime(): Promise<{
remainingTime: number;
}>;
removeAllListeners(): Promise<void>;
}

@@ -1,36 +0,24 @@

import { WebPlugin } from "@capacitor/core";
import { WebPlugin } from '@capacitor/core';
export class TimerNotificationWeb extends WebPlugin {
constructor() {
super(...arguments);
this.remainingTime = 0;
}
async startTimer(options) {
this.remainingTime = options.duration;
if (this.intervalId)
clearInterval(this.intervalId);
this.intervalId = setInterval(() => {
if (this.remainingTime > 0) {
this.remainingTime -= 1;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
}
else {
clearInterval(this.intervalId);
}
}, 1000);
console.log('Timer started with duration:', options.duration);
}
async stopTimer() {
if (this.intervalId) {
clearInterval(this.intervalId);
}
this.remainingTime = 0;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
console.log('Timer stopped');
}
async pauseTimer() {
console.log('Timer paused');
}
async resumeTimer() {
console.log('Timer resumed');
}
async getRemainingTime() {
return { remainingTime: this.remainingTime };
console.log('Fetching remaining time...');
return { remainingTime: 0 }; // Simulate a default remaining time
}
removeAllListeners() {
console.log('All listeners removed');
return super.removeAllListeners(); // Call the base class's implementation
}
}
//# sourceMappingURL=web.js.map

@@ -8,34 +8,22 @@ 'use strict';

class TimerNotificationWeb extends core.WebPlugin {
constructor() {
super(...arguments);
this.remainingTime = 0;
}
async startTimer(options) {
this.remainingTime = options.duration;
if (this.intervalId)
clearInterval(this.intervalId);
this.intervalId = setInterval(() => {
if (this.remainingTime > 0) {
this.remainingTime -= 1;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
}
else {
clearInterval(this.intervalId);
}
}, 1000);
console.log('Timer started with duration:', options.duration);
}
async stopTimer() {
if (this.intervalId) {
clearInterval(this.intervalId);
}
this.remainingTime = 0;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
console.log('Timer stopped');
}
async pauseTimer() {
console.log('Timer paused');
}
async resumeTimer() {
console.log('Timer resumed');
}
async getRemainingTime() {
return { remainingTime: this.remainingTime };
console.log('Fetching remaining time...');
return { remainingTime: 0 }; // Simulate a default remaining time
}
removeAllListeners() {
console.log('All listeners removed');
return super.removeAllListeners(); // Call the base class's implementation
}
}

@@ -42,0 +30,0 @@

@@ -5,34 +5,22 @@ var capacitorTimerNotification = (function (exports, core) {

class TimerNotificationWeb extends core.WebPlugin {
constructor() {
super(...arguments);
this.remainingTime = 0;
}
async startTimer(options) {
this.remainingTime = options.duration;
if (this.intervalId)
clearInterval(this.intervalId);
this.intervalId = setInterval(() => {
if (this.remainingTime > 0) {
this.remainingTime -= 1;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
}
else {
clearInterval(this.intervalId);
}
}, 1000);
console.log('Timer started with duration:', options.duration);
}
async stopTimer() {
if (this.intervalId) {
clearInterval(this.intervalId);
}
this.remainingTime = 0;
this.notifyListeners("remainingTimeUpdate", {
remainingTime: this.remainingTime,
});
console.log('Timer stopped');
}
async pauseTimer() {
console.log('Timer paused');
}
async resumeTimer() {
console.log('Timer resumed');
}
async getRemainingTime() {
return { remainingTime: this.remainingTime };
console.log('Fetching remaining time...');
return { remainingTime: 0 }; // Simulate a default remaining time
}
removeAllListeners() {
console.log('All listeners removed');
return super.removeAllListeners(); // Call the base class's implementation
}
}

@@ -39,0 +27,0 @@

{
"name": "capacitor-timer-notification",
"version": "0.1.4",
"version": "0.1.5",
"description": "timer notifcation",

@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js",

@@ -37,4 +37,6 @@ ## capacitor-timer-notification

* [`stopTimer()`](#stoptimer)
* [`getRemainingTime()`](#getremainingtime)
* [`pauseTimer()`](#pausetimer)
* [`resumeTimer()`](#resumetimer)
* [`addListener('remainingTimeUpdate', ...)`](#addlistenerremainingtimeupdate-)
* [`removeAllListeners(...)`](#removealllisteners)
* [Interfaces](#interfaces)

@@ -53,7 +55,7 @@

Starts the timer with a specified duration.
Starts the timer with the given duration in seconds.
| Param | Type | Description |
| ------------- | ---------------------------------- | -------------------- |
| **`options`** | <code>{ duration: number; }</code> | Duration in seconds. |
| Param | Type | Description |
| ------------- | ---------------------------------- | ---------------------------------------------- |
| **`options`** | <code>{ duration: number; }</code> | - Object containing the duration of the timer. |

@@ -74,12 +76,21 @@ --------------------

### getRemainingTime()
### pauseTimer()
```typescript
getRemainingTime() => Promise<{ remainingTime: number; }>
pauseTimer() => Promise<void>
```
Gets the remaining time of the running timer.
Pauses the currently running timer.
**Returns:** <code>Promise&lt;{ remainingTime: number; }&gt;</code>
--------------------
### resumeTimer()
```typescript
resumeTimer() => Promise<void>
```
Resumes the paused timer.
--------------------

@@ -91,11 +102,11 @@

```typescript
addListener(eventName: "remainingTimeUpdate", listenerFn: (data: { remainingTime: number; }) => void) => Promise<PluginListenerHandle>
addListener(eventName: 'remainingTimeUpdate', listenerFunc: (data: { remainingTime: number; }) => void) => Promise<PluginListenerHandle>
```
Listens for updates on the remaining time.
Listens for updates on the remaining time of the timer.
| Param | Type | Description |
| ---------------- | ---------------------------------------------------------- | ------------------------------------------ |
| **`eventName`** | <code>'remainingTimeUpdate'</code> | Name of the event ('remainingTimeUpdate'). |
| **`listenerFn`** | <code>(data: { remainingTime: number; }) =&gt; void</code> | Callback function with the remaining time. |
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------- |
| **`eventName`** | <code>'remainingTimeUpdate'</code> | - The name of the event, e.g., "remainingTimeUpdate". |
| **`listenerFunc`** | <code>(data: { remainingTime: number; }) =&gt; void</code> | - Callback function that receives the remaining time. |

@@ -107,2 +118,17 @@ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>

### removeAllListeners(...)
```typescript
removeAllListeners(eventName: string) => Promise<void>
```
Removes all listeners for a given event.
| Param | Type | Description |
| --------------- | ------------------- | ------------------------------------------------ |
| **`eventName`** | <code>string</code> | - The name of the event to remove listeners for. |
--------------------
### Interfaces

@@ -109,0 +135,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc