Skip to content

Instantly share code, notes, and snippets.

@brian428
Created May 11, 2010 02:46
Show Gist options
  • Save brian428/396855 to your computer and use it in GitHub Desktop.
Save brian428/396855 to your computer and use it in GitHub Desktop.
package org.swizframework.quickswiz.controller
{
import org.swizframework.quickswiz.service.UserService;
public class UserController
{
[Inject]
public var userService : UserService;
[PostConstruct]
/**
* [PostConstruct] methods are invoked after all dependencies are injected.
*/
public function createDefaultUser() : void
{
userService.loadDefaultUser();
}
}
}
package org.swizframework.quickswiz.controller
{
import org.swizframework.quickswiz.service.UserService;
public class UserController
{
[Inject]
public var userService : UserService;
[PreDestroy]
/**
* [PreDestroy] methods are invoked when a bean is destroyed.
*/
public function clearPollingTimer() : void
{
userService.stopPolling();
}
}
}
[Dispatcher]
public var dispatcher : IEventDispatcher;
private function createNewBean() : void
{
userModel : UserModel = new UserModel();
// Swiz will create a bean for the userModel, and process any metadata in it.
dispatcher.dispatchEvent( new BeanEvent( BeanEvent.SET_UP_BEAN, userModel ) );
}
private function destroyBean() : void
{
// Swiz will destroy the userModel bean, clean up any injected objects, and delete any injection bindings.
dispatcher.dispatchEvent( new BeanEvent( BeanEvent.TEAR_DOWN_BEAN, userModel ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment