Questions tagged [unsubscribe]

190 questions
54
votes
9 answers

Using IDisposable to unsubscribe events

I have a class that handles events from a WinForms control. Based on what the user is doing, I am deferencing one instance of the class and creating a new one to handle the same event. I need to unsubscribe the old instance from the event first -…
Jon B
  • 48,211
  • 29
  • 125
  • 158
51
votes
5 answers

Should I unsubscribe from events?

I have 3 questions concerning events: Should I always unsubscribe events that were subscribed? What happens if I do NOT? In the below examples, how would you unsubscribe from the subscribed events? I have for example this code: Ctor: Purpose: For…
Elisabeth
  • 18,252
  • 48
  • 179
  • 303
44
votes
4 answers

Angular2: Unsubscribe from http observable in Service

What is the best practice to unsubscribe within a Angular2 service from a http subscription? Currently I do this but I'm not sure if this will be the best way. import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import…
NCC-2909-M
  • 567
  • 1
  • 5
  • 15
31
votes
2 answers

Angular - DialogRef - Unsubscribe - Do I need to unsubscribe from afterClosed?

I got asked by one of my colleagues if we need to unsubscribe from the afterClosed() Observable of a Dialog. We are using the takeUntil pattern to unsubscribe from all Observables on ngOnDestroy(). this.backEvent = fromEvent(window, 'popstate') …
liqSTAR
  • 828
  • 7
  • 19
25
votes
1 answer

Gmail unsubscribe link does not appear

In Gmail when you have an email from a newslist, you get a 'unsubscribe' link next to the email address, like this: Google+ Unsubscribe There is header named List-Unsubscribe: which identifies the url or email. In…
Index
  • 628
  • 9
  • 23
17
votes
3 answers

unsubscribe is not a function on an observable

I'm making a drag and drop application and I have created an observable to the mouse position, that repositions my drag-object. mouseMove$: any; constructor(){ this.mouseMove$ = Observable.fromEvent(document, 'mousemove') .do((mouseevent:…
Nate May
  • 3,383
  • 5
  • 29
  • 75
16
votes
1 answer

RxJS - subscribe only once but do not complete Observable

imagine situation when you have some Observable that contains data that changes in real time, example below... interface User { name: string; projectId: string; dataThatChangesALotInRealTime: Object; } userData: Observable This…
Raold
  • 877
  • 3
  • 13
  • 29
14
votes
1 answer

Is it safe to unsubscribe from an event that has never been subscribed?

For example, if these codes: Button button1 = new Button(); // ... button1.Click -= button1_Clicked; are executed before: button1.Click += button1_Clicked; I found no error or exception, but I am wondering if there…
Setyo N
  • 1,734
  • 1
  • 22
  • 28
13
votes
3 answers

Angular RxJS Observable: takeUntil vs. unsubscribe with a Subscription

There are several ways to unsubscribe from observables on Angular components (by using ngOnDestroy). Which option below should be preferred and why (e.g. technical reasons, performance, etc.)? Option 1: takeUntil Using RxJS takeUntil to…
12
votes
1 answer

Strategies to prevent email scanners from activating "unsubscribe" links

I'd like to provide a single-click "Unsubscribe" links in the footer of the emails my service sends. Obviously, many spam scanners will scan emails, and will follow any links found in the emails to scan their contents for malware. A workaround I…
Pēteris Caune
  • 38,874
  • 6
  • 52
  • 76
11
votes
3 answers

What is the best way to implement an unsubscribe link for your newsletter?

I am thinking that I create a deactivation code put that in the unsubscribe link along with their user id. Then when a recipient of my newsletter clicks the link, I can look up their user id and see if the deactivation code matches. Does this sound…
Tony
  • 17,359
  • 29
  • 118
  • 188
9
votes
6 answers

Unsubscribe from delegate passed through ref keyword to the subscription method?

I've got the following class: public class Terminal : IDisposable { readonly List _listeners; public Terminal(IEnumerable listeners) { _listeners = new List(listeners); } public void…
user1098567
  • 299
  • 3
  • 9
9
votes
2 answers

Rails Email with Unsubscribe link

I am working on a Rails 4.2 app that has recurring weekly events that people register for. They will get a reminder email before each event (so weekly). I want a one click unsubscribe link on the email. This seems like a common task but I haven't…
Steve Carey
  • 2,216
  • 17
  • 22
8
votes
2 answers

Angular - what is the preferred way to terminate Observables?

From my understanding of Angular and RxJs there are two ways to terminate Observables. You can unsubscribe() from them or use takeUntil() and complete(). Below are examples of each approach (in pseudocode). The unsubscribe() approach private _id:…
ebakunin
  • 2,832
  • 6
  • 23
  • 41
7
votes
8 answers

Why not use email address in unsubscribe link

Give me few reasons why NOT to include email addresses in plain text form for unsubscribe link that gets sent out in our newsletters. Right now it's: xyz.net/unsubscrible?uid=123&email=user@domamin.com I am pushing for:…
xoail
  • 2,698
  • 4
  • 33
  • 65
1
2 3
12 13