-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8863c80
commit 5987bf7
Showing
14 changed files
with
44 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
Astro.eventManager.on( | ||
'initSchema', function onInitSchemaBehavior(schemaDefinition) { | ||
var schema = this; | ||
|
||
schema.behaviors = schema.behaviors || {}; | ||
|
||
if (_.has(schemaDefinition, 'behaviors')) { | ||
_.extend(schema.behaviors, schemaDefinition.behaviors); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
Astro.SubSchema = function SubSchema(schemaDefinition) { | ||
this.definition = schemaDefinition; | ||
}; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,5 @@ | ||
var addEvent = function(eventName, eventHandler) { | ||
var schema = this; | ||
|
||
schema.eventManager.on(eventName, eventHandler); | ||
}; | ||
|
||
Astro.eventManager.on( | ||
'initSchema', function onInitSchemaEvents(schemaDefinition) { | ||
var schema = this; | ||
|
||
// Add an event manger to the schema. | ||
schema.eventManager = schema.eventManager || Astro.Events.mixin({}); | ||
|
||
// Add events from the schema definition. | ||
if (_.has(schemaDefinition, 'events')) { | ||
_.each(schemaDefinition.events, function(eventHandlers, eventName) { | ||
_.each(eventHandlers, function(eventHandler) { | ||
addEvent.call(schema, eventName, eventHandler); | ||
}); | ||
}); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
Astro.eventManager.on( | ||
'initSchema', function onInitSchemaFields(schemaDefinition) { | ||
var schema = this; | ||
|
||
schema.fields = schema.fields || {}; | ||
schema.fieldsNames = schema.fieldsNames || []; | ||
|
||
if (_.has(schemaDefinition, 'fields')) { | ||
_.extend(schema.fields, schemaDefinition.fields); | ||
schema.fieldsNames = _.union( | ||
schema.fieldsNames, _.keys(schemaDefinition.fields) | ||
); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
Astro.eventManager.on( | ||
'initSchema', function onInitSchemaIndexes(schemaDefinition) { | ||
var schema = this; | ||
|
||
// Add the "indexes" attribute to the schema. | ||
schema.indexes = schema.indexes || {}; | ||
|
||
if (_.has(schemaDefinition, 'indexes')) { | ||
_.extend(schema.indexes, schemaDefinition.indexes); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
Astro.eventManager.on( | ||
'initSchema', function onInitSchemaMethods(schemaDefinition) { | ||
var schema = this; | ||
|
||
schema.methods = schema.methods || {}; | ||
|
||
if (_.has(schemaDefinition, 'methods')) { | ||
_.extend(schema.methods, schemaDefinition.methods); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters