export function setMeta(appInfo, plugins = [], appQuery) { if (!appInfo || !appInfo.view) return const appName = appInfo.name if (cache.meta.has(appName) && JSON.stringify(plugins.sort()) === JSON.stringify(cache.plugin.get(appName).toJS().sort())) return cache.plugin = cache.plugin.set(appName, fromJS(plugins)) setMetaForce(appName, appInfo.viewByImmutable || appInfo.view, appQuery) }
const remove = (todoCollection: TodoCollection, id: string): TodoCollection => { return todoCollection.withMutations(state => { let i = ReverseLookup.get(todoCollection.idTable, id).first(); let creatorID = todoCollection.todos.get(i).creatorID; return state .update("todos", todos => todos.remove(i)) .update("idTable", idTable => ReverseLookup.remove(idTable, id)) .update("creatorTable", creatorTable => ReverseLookup.remove(creatorTable, creatorID, i)); }); }
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer object's updated message using Moment return openCourseCntr.withMutations(ocCntr => { ocCntr.set('updatedMsg', moment(ocCntr.get('ajaxEnd'), 'YYYY-MM-DD:HH:mm:ss.SSS').fromNow()); // Turn off the chart animation for the updated message refresh ocCntr.set('animateChart', false); }); })); })
state.coursesCntr.withMutations(coursesCntr => { const courses = coursesCntr.get('allCourses') .filter(course => course.get('id') !== action.deletedCourseCntr.courseId) .sort(sortByTitle); coursesCntr.set('allCourses', courses) .set('statusText', action.deletedCourseCntr.statusText) .set('ajaxStart', action.deletedCourseCntr.ajaxStart) .set('ajaxEnd', action.deletedCourseCntr.ajaxEnd); })
function add_keyword(keyword){ var id = Date.now(); var _keywords = _state.get('keywords'); keyword = keyword.trim(); if(keyword != '' && _keywords.indexOf(keyword) < 0){ _keywords.push(keyword); _state = _state.set('keywords',_keywords); AppActions.detect_google_position(keyword, _state.get('domain')); return true; } return false; }
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses') .push( initialOpenCourseCntr.openCourseCntr.set('openCourse', action.newOpenCourseCntr.openCourse) .set('courseName', action.newOpenCourseCntr.courseName) .set('statusText', action.newOpenCourseCntr.statusText) .set('ajaxStart', action.newOpenCourseCntr.ajaxStart) .set('ajaxEnd', action.newOpenCourseCntr.ajaxEnd) ) .sort(sortByCourseName) ); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer object's updated message using Moment if (openCourseCntr.get('openCourse').get('id') === action.openCourseIdAndSecs.openCourseId) { return openCourseCntr.set('animateChart', false).set('refreshSeconds', action.openCourseIdAndSecs.seconds); } return openCourseCntr.set('animateChart', false); })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { if (openCourseCntr.get('openCourse').get('id') === action.updatedOpenCourseErrorCntr.openCourseId) { return openCourseCntr.set('statusText', action.updatedOpenCourseErrorCntropenCourseCntr.statusText) .set('ajaxStart', action.updatedOpenCourseErrorCntropenCourseCntr.ajaxStart) .set('ajaxEnd', action.updatedOpenCourseErrorCntropenCourseCntr.ajaxEnd); } return openCourseCntr; })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Find matching OpenCourseContainer object and return the new OpenCourseContainer object. if (openCourseCntr.get('openCourse').get('id') === action.deleteOpenCourseErrorCntr.openCourseId) { return openCourseCntr.set('statusText', action.deleteOpenCourseErrorCntr.statusText) .set('ajaxStart', action.deleteOpenCourseErrorCntr.ajaxStart) .set('ajaxEnd', action.deleteOpenCourseErrorCntr.ajaxEnd); } return openCourseCntr; })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer's "updating" property to ture if (openCourseCntr.get('openCourse').get('id') === action.openCourseId) { return openCourseCntr.set('updating', true).set('animateChart', false); } return openCourseCntr.set('animateChart', false); })); })