Let the page add its own clipboard load/save hooks.
This commit is contained in:
parent
1b631b33e9
commit
b02374136f
1 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
var photo_clipboard = new Set();
|
var photo_clipboard = new Set();
|
||||||
|
var on_clipboard_load_hooks = [];
|
||||||
|
var on_clipboard_save_hooks = [];
|
||||||
|
|
||||||
// Load save ///////////////////////////////////////////////////////////////////////////////////////
|
// Load save ///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -17,6 +19,12 @@ function load_photo_clipboard(event)
|
||||||
{
|
{
|
||||||
photo_clipboard = new Set(JSON.parse(stored));
|
photo_clipboard = new Set(JSON.parse(stored));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var index = 0; index < on_clipboard_load_hooks.length; index += 1)
|
||||||
|
{
|
||||||
|
on_clipboard_load_hooks[index]();
|
||||||
|
}
|
||||||
|
|
||||||
return photo_clipboard;
|
return photo_clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +34,11 @@ function save_photo_clipboard()
|
||||||
var serialized = JSON.stringify(Array.from(photo_clipboard));
|
var serialized = JSON.stringify(Array.from(photo_clipboard));
|
||||||
localStorage.setItem("photo_clipboard", serialized);
|
localStorage.setItem("photo_clipboard", serialized);
|
||||||
on_storage();
|
on_storage();
|
||||||
|
|
||||||
|
for (var index = 0; index < on_clipboard_save_hooks.length; index += 1)
|
||||||
|
{
|
||||||
|
on_clipboard_save_hooks[index]();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue