;__;
This commit is contained in:
parent
fca2645787
commit
5785f9cda3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -321,9 +321,6 @@ Main =
|
||||
delete posts[id] for id of posts when posts.hasOwnProperty id
|
||||
delete threads[id] for id of threads when threads.hasOwnProperty id
|
||||
|
||||
g.threads = threads
|
||||
g.posts = posts
|
||||
|
||||
disconnect: (view) ->
|
||||
if g.VIEW is 'thread'
|
||||
features = [
|
||||
|
||||
@ -1,20 +1,28 @@
|
||||
class Callbacks
|
||||
push: ({name, cb}) -> @[name] = cb
|
||||
constructor: (@type) ->
|
||||
@keys = []
|
||||
|
||||
push: ({name, cb}) ->
|
||||
@[name] = cb
|
||||
@keys.push name
|
||||
|
||||
clean: ->
|
||||
@rm name for name of @ when @hasOwnProperty name
|
||||
@rm name for name in @keys
|
||||
return
|
||||
|
||||
rm: (name) -> delete @[name]
|
||||
rm: (name) ->
|
||||
return unless @[name]
|
||||
delete @[name]
|
||||
@keys.splice @keys.indexOf(name), 1 # Didn't I make this structure to avoid this? ;__;
|
||||
|
||||
execute: (node) ->
|
||||
for name of @ when @hasOwnProperty name
|
||||
for name in @keys
|
||||
try
|
||||
@[name].call node
|
||||
catch err
|
||||
errors = [] unless errors
|
||||
errors.push
|
||||
message: ['"', name, '" crashed on node No.', node, ' (', node.board, ').'].join('')
|
||||
message: ['"', name, '" crashed on node ', @type, ' No.', node, ' (', node.board, ').'].join('')
|
||||
error: err
|
||||
|
||||
Main.handleErrors errors if errors
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
class Post
|
||||
@callbacks = new Callbacks()
|
||||
@callbacks = new Callbacks 'Post'
|
||||
toString: -> @ID
|
||||
|
||||
constructor: (root, @thread, @board, that={}) ->
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
class Thread
|
||||
@callbacks = new Callbacks()
|
||||
@callbacks = new Callbacks 'Thread'
|
||||
toString: -> @ID
|
||||
|
||||
constructor: (@ID, @board) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user