Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AutoSave Example - Angular #43

Open
wants to merge 2 commits into
base: v1.x/master
Choose a base branch
from

Conversation

miteshgoplani
Copy link

@miteshgoplani miteshgoplani commented Jul 2, 2020

This PR serves as an example of how to subscribe to an AutoSave Event by Zowe Desktop for an Angular Application

This example demonstrates how to save the parameters and AppId of Angular App:

1. Inject the Session Events token
@Inject(Angular2InjectionTokens.SESSION_EVENTS) private sessionEvents: Angular2PluginSessionEvents

2. Subscribe to autosaveEmitter

   this.autoSaveEvent = this.sessionEvents.autosaveEmitter.subscribe((saveThis: any)=> {
      if (saveThis) {
        saveThis({'appData':{'requestText':this.parameters,'targetAppId':this.targetAppId}});
      }
    });

3. Receive saved data
In order to receive the data, use data.appData.requestText and data.appData.targetAppId as seen in handleLaunchOrMessageObject()

Note:

  1. It is necessary to unsubscribe to the AutoSave Event when the component is destroyed
  2. You must add an autosave property to pluginDefinition "autosave": true

Signed-off-by: miteshgoplani [email protected]

@miteshgoplani miteshgoplani changed the title [WIP] Add AutoSave Example [WIP] Add AutoSave Example - Angular Jul 2, 2020
@miteshgoplani miteshgoplani changed the title [WIP] Add AutoSave Example - Angular Add AutoSave Example - Angular Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant