private void notifyChange() { Runtime.postToMainThread( () -> { for (ModelChangedListener<UserVM> l : listeners) { l.onChanged(UserVM.this); } }); }
/** * Subscribe to UserVM updates * * @param listener UserVM changed listener */ @MainThread @ObjectiveCName("subscribeWithListener:") public void subscribe(@NotNull ModelChangedListener<UserVM> listener) { // Runtime.checkMainThread(); if (listeners.contains(listener)) { return; } listeners.add(listener); listener.onChanged(this); }