Skip to content
secretrobotron edited this page Dec 10, 2012 · 3 revisions

#Project (Module)

Provides Project management functionality to Butter.

Usage:

var Project = require('path/to/module/project.js');

#Project::Project (public Class)

Maintains the state and persistence for a Butter project.

  • butter [ Butter ]: A Butter instance.

Usage:

var p = new Project(butter);

##Project::Project::export (public Member Function)

Constructs a string from a JSON object which represents the current project.

@see: Project::Project::import
@return [ String ]: Stringified JSON.

Usage:

_this.export();

##Project::Project::import (public Member Function)

Prepares a project from the description provided within the given JSON object.

  • json [ String ]: Stringified JSON structure to import as project data.

@see: Project::Project::export

Usage:

_this.import(json);

##Project::Project::invalidate (private Member Function)

Places this project in a dirty state.

@event: projectchanged

Usage:

invalidate();

##Project::Project::save (public Member Function)

Saves and publishes a project. Saving only happens if project data needs to be saved (i.e., it has been changed since last save, or was never saved before).

  • callback [ Function ]: Called when save operation (success or failure) has completed.

Usage:

_this.save(callback);

##Project::Project::startBackups (private Member Function)

Starts backup ticker which issues backup requests on a timeout.

Usage:

startBackups();

##Project::save (public Class Function)

Check for an existing project that was autosaved but not saved. Returns project backup data as JS object if found, otherwise null. NOTE: caller must create a new Project object and call import.

  • butter [ Butter ]: A Butter instance.
  • callback [ Function ]: Called when save operation (success or failure) has completed.

Usage:

Project.save(butter, callback);

Clone this wiki locally