API: lifecycle
Source:
platform/lifecycle.ts
Provides a wrapper for managing the application lifecycle (publish/unpublish)
Usage
import { bytes } from "sdk/io";
import { user } from "sdk/security";
import { workspace, lifecycle } from "sdk/platform";
import { response } from "sdk/http";
const currentUser = user.getName();
const workspaceName = "workspace";
const projectName = "project";
let myWorkspace = workspace.createWorkspace(workspaceName);
let myProject = myWorkspace.createProject(projectName);
let myFile = myProject.createFile("file.js");
myFile.setContent(bytes.textToByteArray("console.log('Hello World!');"));
let publishResult = lifecycle.publish(currentUser, workspaceName, projectName);
response.println("publishResult: " + publishResult)Classes
Lifecycle
@class Lifecycle
@description Static utility class to publish and unpublish projects on the platform.
Methods
publish
publish (user:string, workspace:string, project:string="*"):booleanPublishes a project for a specific user and workspace.
@param {string} user The username of the owner of the workspace.
@param {string} workspace The name of the workspace to publish from.
@param {string} [project=""] The specific project name to publish. Use "" to publish all projects in the workspace.
@returns {boolean} True if the publish operation was successful, false otherwise.
unpublish
unpublish (project:string="*"):booleanUnpublishes a currently deployed project.
@param {string} [project=""] The specific project name to unpublish. Use "" to unpublish all currently deployed projects.
@returns {boolean} True if the unpublish operation was successful, false otherwise.