Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
zhuochun edited this page Sep 8, 2012 · 1 revision

Introduction

Use jQuery pubsub to achieve meditator and events function.

$.publish("event", [a, b]);

$.subscribe("event", function(e, a, b) {
    // Do Something
});

Published Events from Each Component

General Message Events

  • message:error -> @param string
  • message:info -> @param string
  • message:warning -> @param string
  • message:success -> @param string

App (app.js) Publishes

  • app:status:new, app:status:updated, app:status:uptodate

Global (global.js) Publishes

  • app:<key> <- when app value changes
  • app:user:<key> <- when user value changes

Modules (modules.js) Publishes

  • <ListName>:addOne -> @param Module
  • <ListName>:addOne:duplicated -> @param Module
  • <ListName>:removeOne -> @param Module
  • <ListName>:clean -> No @params
  • <ListName>:duplicatedExamDate -> @param Module, @param Module

App View (appView.js) Publishes

  • app:window:resize

Add Module View (addModuleView.js) Publishes

  • module:add -> @param string modCode
  • module:preview -> @param string modCode

Basket Module View (basketView.js) Publishes

  • module:preview -> @param string modCode

Detail View (detail.js) Publishes

  • module:add -> @param string modCode

Modules Controller (modulesController.js) Publishes

  • module:detail -> @param Module

Subscribed Events from Each Component

Modules Controller (modulesController.js) Subscribes

  • module:aad, module:preview, <preview.list>:addOne

Basket Module View (basketView.js) Subscribes

  • <modules.list>:addOne

Detail View (detail.js) Subscribes

  • app:status:new, app:status:updated, app:status:uptodate
  • module:detail
  • <preview.list>:addOne

Detail View (detail) Subscribes

  • message:error, message:info, message:warning, message:success
  • <modules.list>:duplicatedExamDate